In this blog, we will focus on MuleSoft Certification preparation. The below topics are covered with examples.
Certification is not free and the candidate has to pay $250 for it.
Below are some insights into the concepts/questions from the exams which I do remember.
I hope this helps. All the best for your exam. Please feel free to reach out with your queries, if any.
Scope of the Variable/Payload inside/outside the for each processor and batch job processor
eg :
variable/payload outside the for each processor, then manipulated inside for each and logged outside for each again. What is the final value of payload/variable at that time. Similarly, variable/payload set outside batch job processor then values manipulated inside the batch steps. Then logged outside the batch job. What are the expected values.
Input to and output expected from different dataweave patterns like Scatter-gather, fileList, choice. e.g :
the type of input these operations expect and the type of output they give out like map operation has an input as array. Scatter-Gather has an output as “object of mule event objects”. For more details you may refer my this blog – – Mule 4 + MuleSoft + Scatter-Gather Integration Pattern + Example
Output for the operation “typeOf” from Dataweave expression.
eg :
if the payload is set as application/json and there is a logger at the end which logs the type of object of the payload with the operation typeOf(payload). We need to specify the payload object has what type could be linkedHashMap/caseInsensitiveHashMap/ String/ array/ Obejct etc.. Depending on the previous operations we need to determine the type of object of the payload
RAML designing for queryParams and pathParams
Scopes of the payload. variables and attributes within the childFlow/subFlow depending upon the trigger for those flows. Also, scope of the variables and payload in the main flow after the response is returned from the child flow.
Specific question -> Variables are part of what – Mule Event , message , attributes or payload
Questions around syntax for “!include” a particular file within RAML specification. Options for these questions are almost similar, please look at those carefully.
Exception handling for onErrorPropagate and onErrorContinue and their scopes within subFlow/flowReference
Syntax importing a custom module in the Dataweave language and using the operation from that module.
Given 4 different listener specifications using same host and different ports 8000 and 9000. How many different listeners are needed to be configured as part of global spec. – depends on the number of different host-port combinations.2 in this case as host is same and two diff ports.
forEach vs batchJob – which is singleThreaded and which is multi-threaded
If the API implementation is changed not the API specifications – what action is needed in the API manager or what action is needed at the clients consuming the APIs
An error picture was given which said the maven dependency resolution was not happening – select the option which has steps to resolve those errors.
Questions around structuring of the mule apps – placing the file in which folder. making which element global. Passing the configurations in the property file.
FTP component read file operation – what it does to the file after reading it. For more details you may refer my this blog – Mule 4 + MuleSoft + File Connector – File Operations + Example
Defining and using variables within DB queries.
e.g :
SELECT * from Table where abc = :abc defining :abc and using it in DB query.
Data transformations from JSON to xml and xml to JSON, JSON to different JSON – 4-5 questions for these transformations. Options are tricky here as well.
Also, you may refer following article on DataWeave Language Expression for new features : Mule 4 + MuleSoft + DataWeave 2.3.0 New Features + Example
Setting the payload to a variable and accessing it later – 1 question around this concept. Screenshot was given wherein the payload was being set in the variable not as output.
A screenshot for a rest client was given with error 415 – unsupported media type. select the Option to get away with this error
Batch processing / filters and aggreagators. Question around given data [a,b,c,d,e,f] passed to a batch job. Batch step has filter !=b then aggregate runs in a batch of three and then a logger Question was around the last logged value.
Question around how much time will scatter gather take to complete – it has 2 tasks – task1 takes 1 second and task 2 takes 5 second. Uses the concept of parallel processing in scatter gather
NOTE: The self assessment quiz in the training portal is something similar to the exam. You can go through that thoroughly. Getting the core concepts is the key.
A C4E is defined as a group that drives the IT operating model shift. It is in charge of enabling business
divisions — including but not exclusively IT — to build and drive the consumption of assets successfully,
thereby enabling speed and agility. It allows the business and IT teams to shift from a production-based to a
production-and-consumption-based delivery model API-Led (System, Process, and Experience API)
Know the basic functions of the various Anypoint Platform components, especially Design
Center, Exchange, Runtime Manager, and API Manager
Reference: https://docs.mulesoft.com/runtime-manager/cloudhub-architecture
During Designing APIs we need to focus on below key points.
1. Purpose of:
○ Design Center
○ Exchange ( https://docs.mulesoft.com/exchange/ )
2. How to format a URL call to an API with
○ URI parameters
https://anypoint.mulesoft.com/mocking/api/v1/accounts/{id}
https://anypoint.mulesoft.com/mocking/api/v1/accounts/4400
○ Query parameters:
https://anypoint.mulesoft.com/mocking/api/v1/accounts?type=personal
3. Include RAML fragments in a RAML document (e.g. !include folderName/fragmentName.raml)
4. Format XML example data in RAML (the sample quiz in training.mulesoft.com is an excellent reference)
The Anatomy of a Mule Event
Attributes and variables (and their accessibility within a flow) change depending on when they are referenced and how the flow is executed (Flow Ref vs a transport boundary ( HTTP Request, JMS queue, etc))
Examples:
A. Via a Flow reference – Parent passes variables and attributes to a child flow: Variables and attributes are accessible, changeable, and seen back in the parent flow.
B. Via a Transport Boundary (HTTP, JMS) – Variables are NOT accessible; Attributes are removed and/or replaced with new attributes.
Mule Message Structure
Understanding the Mule message structure is important as facets of the structure influence several exam questions across different topic areas.
Reference: https://docs.mulesoft.com/mule-runtime/4.2/about-mule-message
Mule Message: [Attributes, Payload, Variables]
Attributes : Attributes contain the metadata associated with the body (or payload) of the message. The specific attributes of a message depend on the connector (such as HTTP, FTP, File) associated with the message.
Reference : https://docs.mulesoft.com/mule-runtime/4.2/global-settings-configuration
Global settings for a mule application such as the default transaction timeout or default error handler can be configured in the <configuration> element of the root level of the Mule Configuration File.
The path of an HTTP listener can be static, which requires exact matches, or feature placeholders. Placeholders can be wildcards ( * ), which match against anything they are compared to, or parameters ( {param} ), which not only match against anything but also capture those values on a URI parameters map
Reference : https://docs.mulesoft.com/connectors/http/http-listener-ref
Working Example Reference : Mule 4 + MuleSoft as Microservices Architecture + HTTP Connector + Example
Returns a Java object of records, see screen capture below of debug session where the Payload Type (typeOf(payload)) is an Array and the media type is application/java.
Output: Database select statement that produces zero records results in an empty array
For more details we can go through following reference
Reference: https://docs.mulesoft.com/api-manager/2.x/api-auto-discovery-new-concept
Applications on CloudHub are run by one or more instances of Mule, called workers. These have the following characteristics:
○ Capacity : Each worker has a specific amount of capacity to process data, you can select the size of your workers when configuring an application.
○ Isolation : Each worker runs in a separate VM from every other application.
○ Manageability : Each worker is deployed and monitored independently.
○ Locality : Each worker runs in a specific worker cloud, the US, EU, Asia-Pacific, etc.
○ A Cloudhub worker supports at most one applications
○ application’s properties are defined in a .properties file stored in /classes folder e.g ${https.port}
Note: that a variable in the Mule event is different from variables defined in a DataWeave script, which are local to the script and not accessible outside of it.
Reference:https://docs.mulesoft.com/mule-runtime/4.2/about-mule-variables
The attributes of the message will include:
○ method:
○ listenerPath:
○ requestPath:
○ relativePath:
○ queryParams: a multi-map
○ uriParams: a map
○ headers: a multi-map
Example: #[attributes.uriParams.state]
Example: What is the value of Payload at the Logger step?
Answer : LoggerMessageProcessor: Payload:3
Explanation: call to Publish Consume increments the payload by 1, but the call to Publish does not affect the payload as the flow proceeds without waiting for the response.
Create a Lightweight Package You can skip bundling the actual modules and external dependencies required to run the Mule application in a Mule runtime engine, and create a lightweight package with only the source files and metadata required to import the JAR package back into Anypoint Studio. From the command line in your project’s folder, as below.
run: $ mvn clean package -DlightweightPackage
When we specify this parameter, the plugin creates a lightweight JAR file that does not include any dependencies declared in the Mule application’s pom.xml file. This JAR file cannot be deployed to a Mule runtime engine, it only offers a way to archive just the Mule application’s source files. The result of this Maven parameter is the same as unchecking Include project modules and dependencies when exporting the Mule application from Anypoint Studio.
In Studio, to use this connector as an HTTP Request Connector (and not an HTTP
Listener Connector), place it into the Process section of a flow. Reference: https://docs.mulesoft.com/mule-runtime/3.9/http-request-connector
Analogous to if/then/else. Message is routed to the first condition that evaluates as true
Working Example Reference: Mule 4 + MuleSoft + Choice Router Control + Java Module + Example
For more details you may go through this example, Reference: Mule 4 + MuleSoft + Scatter-Gather Integration Pattern + Example
Reference : https://docs.mulesoft.com/mule-runtime/3.9/validations-module
You may walk through my blog for Handling Errors in Mule 4
Handling Errors Examples : Mule 4 + MuleSoft + Error Handling Techniques + Examples
1. When an error is raised the remainder of the flow is not processed
2. a). If there is not an error handler then the Mule default error handler propagates the error status and error message back to the caller.
b). If there is an error handler then all steps in the error handler are processed. The error handler can either propagate or continue.
DataWeave is the MuleSoft expression language for accessing and transforming data that travels through a Mule app. DataWeave is tightly integrated with the Mule runtime engine, which runs the scripts and expressions in your Mule app.
DataWeave 2.0 functions are packaged in modules. Functions in the Core ( dw::Core ) module are imported automatically into your DataWeave scripts. To use other modules, you need to import the module or functions you want to use by adding the import directive to the head of your DataWeave script, for example:DataWeave 2.0 functions are packaged in modules.
Functions in the Core ( dw::Core ) module are imported automatically into your DataWeave scripts. To use other modules, you need to import the module or functions you want to use by adding the import directive to the head of your DataWeave script, for example:
Example: … String {format: ".0#"} 1. ++ to append strings and literals in an expression 2. == for equals in an expression 3. * for repeated elements (e.g. - payload.users.*user) 4. DW expressions are placed INLINE in the code and are enclosed in ‘#[ ] 5. The Map operator for the Array input type (DW2.0) 6. The Map operator is enclosed {()}. {} defines the object, () transforms each element in the object. 7. In a DW transformation, $ refers to the value of an element 8. DW produces 3 types of output: A. Objects: Collections of key:value pairs B. Arrays: Sequence of csv’s C. Simple Literals 9. LookUp Function This function enables you to execute a flow within a Mule app and retrieve the resulting payload. It works in Mule apps that are running on Mule Runtime version 4.1.4 and later. Similar to the Flow Reference component (recommended), the lookup function enables you to execute another flow within your app and to retrieve the resulting payload. It takes the flow’s name and an input payload as parameters. For example, lookup("anotherFlow", payload) executes a flow named anotherFlow. The function executes the specified flow using the current attributes, variables, and any error, but it only passes in the payload without any attributes or variables. Similarly, the called flow will only return its payload. Note that lookup function does not support calling subflows. 10. Example: A flow sets a payload to a variable images. How do you access that variable in DW?: Answer. #[vars.images] 11. Http://acme.com/usernames/CA. ‘CA’ is the state and that URI parameter gets stored in the attributes of a Mule message. What is the DW expression to retrieve ‘CA’? Answer. #[attributes.uriParams.state]
Note : DataWeave New Features Reference: Mule 4 + MuleSoft + DataWeave 2.3.0 New Features + Example
Working Example Reference : Mule 4 + MuleSoft + Choice Router Control + Java Module + Example
Reference Url for Manual Watermarking: https://blogs.mulesoft.com/dev/mule-dev/how-poll-scope-and-watermark/
For Each Scope: For Each processes a collection (java, JSON, XML). If the payload is not a collection, e.g. it is an object, then the For Each will not process the payload.
Batch Processing: A batch job is a scope that splits large messages into records that Mule processes asynchronously.
Batch Filter and Batch Aggregator: You can use the batch aggregator scope to accumulate a subset of records from a batch step, and bulk upsert them to an external source or service. The Batch Aggregator, Aggregator Size field determines the number of records processed by the aggregator. As a simple example, if the batch size is only 3 records and the aggregator size is set to 2, the aggregator will process the first 2 records to reach that step, then process the one remaining record at the end of the batch step.
Working Example Reference : Mule 4 + MuleSoft + Enterprise Integration Patterns + Examples
Here, I am posting some sample questions answers from the exam which I do remember.
Question: Refer to the exhibits.
A web client sends a POST request with the payload {“oid”: “1000”, “itemid”: “AC200”, “qty”: “4” } to the Mule application. The File Write operation throws a FILE:CONNECTIVITY error. What response message is returned to the web client?
A. FILE:CONNECTIVITY
B. OTHER ERROR
C. File written
D. ORDER:NOT_CREATED
Answer: D
Question: Refer to the exhibits.
A web client sends a GET request to the HTTP Listener. What response message is returned to the web client?
A. “”
B. “Start”
C. “String is not blank”
D. “End”
Answer: C
Question: A Database On Table Row listener retrieves data from a CUSTOMER table that contains a primary key user_Id column and an increasing bgin_date_time column. Neither column allows duplicate values. How should the listener be configured so it retrieves each row at most one time?
A. Set the watermark column to the user_Id column
B. Set the target value to the last retrieved user_Id value
C. Set the target value to the last retrieved login_date_time value
D. Set the watermark column to the bgin_date_time column
Answer: D
Question: Refer to the exhibits.
What Database expression transforms the input to the output?
A. Option B
B. Option D
C. Option A
D. Option C
Answer: B
Question: Refer to the exhibits. What payload is logged at the end of the main flow?
A. order4
B. order1order2order3order4
C. [1, 2, 3, 4]
D. [order1, order2, order3, order4]
Answer: C
Question: Refer to the exhibits.
The error occurs when a project is run in Anypoint Studio. The project, which has a dependency that is not in the MuleSoft Maven repository, was created and successfully run on a different computer. What is the next step to fix the error to get the project to run successfully?
A. Install the dependency to the computer’s local Maven repository
B. Edit the dependency in the Mule project’s pom.xml file
C. Deploy the dependency to MuleSoft’s Maven repository
D. Add the dependency to the MULE_HOME/bin folder
Answer: A
Question: What DataWeave expression transforms the example XML input to the CSV output?
A. Option C
B. Option B
C. Option A
D. Option D
Answer: C
Question: Refer to the exhibit.
What should be changed to fix the 415 error?
A. set the response Content-Type header to text/plain
B. set the response Content-Type header to application/xml
C. set the request Content-Type header to application/json
D. set the request Content-Type header to text/text
Answer: C
Question: Refer to the exhibits.
The Validation component in the Try scope throws an error. What response message is returned to a client request to the main flow’s HTTP Listener? The Validation component in the Try scope throws an error. What response message is returned to a client request to the main flow’s HTTP Listener?
A. Error – main flow
B. Success – main flow
C. Error – Try scope
D. Validation Error
Answer: A
Question: Refer to the exhibit.
The Database Select operation returns five rows from a database. What is logged by the Logger component?
A. CaselnsensitrveHashMap
B. LinkedHashMap
C. Object
D. Array
Answer: B
Note: Keep visiting this page. Will add more questions & answers with sample code soon. Thank You:)