Module 2 — Building a Real Mule Flow
We’ll build this:
POST /customers
↓
HTTP Listener
↓
Validate / preserve request
↓
Transform JSON → Salesforce Account
↓
Salesforce Upsert
↓
Transform Salesforce result → API response
↓
HTTP 200/201
This is a very typical MuleSoft pattern. MuleSoft’s own Salesforce examples use essentially the same sequence: HTTP Listener → Transform Message → Salesforce operation → Transform Message.
2.1codeOur requirementAssume another system sends this:2.2What the flow looks like in Anypoint StudioImagine these boxes on the canvas:2.3codeHTTP ListenerThe first component is the source of the flow.2.4codeWhat happens when the request arrives?For:2.5codePreserve the original requestThis is one of the first development habits I'd use.2.6codeTransform MessageNow we transform our API contract into Salesforce's contract.2.7codeWhy `application/java`?This can look strange.2.8codeSalesforce UpsertNext box:2.9codeSalesforce global configurationLike HTTP, Salesforce needs a reusable connector configuration.2.10codeNow something important happens to `payload`Before Salesforce:2.11codeBuild the API responseWe don't want the consumer receiving some raw Salesforce connector object.2.12codePut the entire flow togetherConceptually:2.13codeLet's make it slightly more realisticA developer probably wouldn't just blindly accept:2.14codeAdd loggingAnother realistic flow:2.15codeWhat if we need Account + Contact?Now we start getting closer to real Mule work.2.16codeSaving the Salesforce Account IDAfter Account Upsert:2.17Your first integration orchestrationThe whole flow becomes:2.18A developer question you're likely to getInterviewer:2.19codeBut sometimes you DO query firstExample requirement:2.20codeThree ways integrations often become messyEverything in one gigantic flow:2.21What your previous QA work was actually testingThis is worth recognizing because you are closer to development than it might feel.2.22Q&AInterview vocabulary from this moduleBe comfortable naturally using:2.23Q&AFive likely interview questionsQ: What happens to the Mule payload after a Salesforce operation?•The picture to memorizeIf the interviewer hands you a blank screen and says: