What is the correct Syntax to add a customer ID as a URI parameter in the HTTP listener's path attribute?
Answer : C
URL parameters are always accessed using { } like => {customerID}
Refer to the below exhibit.
A Mule application configures a property placeholder file named config.yaml to set some property placeholders for an HTTP connector.
What is the valid properties placeholder file to set these values?
Answer : B
Correct answer is as below as it follows the correct syntax.
http:
basepath: 'api'
host : 'localhost'
port : '8081'
Mule Doc Reference :https://docs.mulesoft.com/mule-runtime/4.3/mule-app-properties-to-configure
Refer to the exhibits. In the choice router, the When expression for the domestic shipping route is set to "#[payload= "FR"]".
What is the output of logger after the execution of choice router is completed?
Answer : D
To compare, DataWeave syntax is #[payload == 'FR'].
In this case only one = is used so it will give syntax error.
Hence the correct answer isA dataweave syntax error
A shopping API contains a method to look up store details by department.
To get the information for a particular store, web clients will submit requests with a query parameter named department and uri parameter named storeId
What is valid RAML snippet that supports requests from a web client to get a data for a specific storeId and department name?
Answer : D
Lets revise few concepts RAML which can help us to find the answer of this question.
URI Parameters
Lets have a look at below example.
/foos:
/{id}:
/name/{name}:
Here, the braces { } around property names define URI parameters. They represent placeholders in each URI and do not reference root-level RAML file properties as we saw above in thebaseUrideclaration. The added lines represent the resources/foos/{id}and/foos/name/{name}.
Query Parameters
Now we'll define a way to query thefooscollection using query parameters. Note that query parameters are defined using the same syntax that we used above for data types:
/foos:
get:
description: List all Foos matching query criteria, if provided;
otherwise list all Foos
queryParameters:
name?: string
ownerName?: string
Based on the above information , below is the only option which definesstoreidas uri parameter anddepartmentas query parameter.
/{storeId}:
get:
queryParameter:
department:
Refer to the exhibit.
How should be the where clause written for the configured input parameters in such a way that it achieves below SQL query?
Answer : C
Correct syntax to use where clause isWHERE city = :city AND state = :state
This question validates knowledge on using dynamic queries in DBselect operation.
Configure Dynamic Queries in the Select Operation
When you need to parameterize not only theWHEREclause but also parts of the query itself (for example, queries that compare tables that depend on a condition, or complex queries for which the project table columns need to vary), you can configure dynamic queries.
In the following example, you configure a dynamic query by using a full expression with a string in which the table depends on a variable$(vars.table). Although some of the query text is dynamic ('SELECT * FROM $(vars.table)), theWHEREclause still defines theWHEREcondition using input parameters: in this case,WHERE name = :name.
In your Studio flow, select theSelectoperation.
In the operation configuration screen, set theSQL Query Textfield toSELECT * FROM $(vars.table) WHERE name = :name.
Set theInput Parametersfield to{'name' : payload}.
The following screenshot shows the configuration in Studio:
Figure 3. Dynamic query configuration
In the XML editor, the<db:sql>configuration looks like this:
<set-variable variableName='table' value='PLANET'/>
<db:select config-ref='dbConfig'>
<db:sql>#['SELECT * FROM $(vars.table) WHERE name = :name']</db:sql>
<db:input-parameters>
#[{'name' : payload}]
</db:input-parameters>
</db:select>
You can apply input parameters only to parameters in aWHEREclause. To modify any other part of the query, use the DataWeave interpolation operator.
Mule Ref Doc:Query a Database Examples - Mule 4 | MuleSoft Documentation
Refer to the exhibits.
The Batch Job scope contains two Batch Steps scopes with different accept expression.
The input payload is passed to the Batch Job scope.
After the entire payload is processed by the batch job scope , what messages have been logged by the Logger component?
Answer : D
This question validates you knowledge on Batch Processing. Before we analyze the question , lets revise a bit about batch filters.
Batch Filters
You can apply one or more filters as attributes to any number of batch steps. Imagine a batch job whose first batch step checks if a Salesforce contact exists for a record, and a second batch step that updates each existing Salesforce contact with new information. You can apply a filter to the second batch step to ensure it only processes records that didn't fail during the first batch step. By having batch steps accept only some records for processing, you streamline the batch job so the Mule runtime engine can focus only on the relevant data for a particular batch step.
A batch step uses two attributes to filter records:
acceptExpression
acceptPolicy
Each batch step can accept oneacceptExpressionand oneacceptPolicyattributes to filter records.
Use theacceptExpressionattribute to process only records that evaluate to true; if the record evaluates to false, the batch step skips the record and sends it to the next one. In other words, the records with an accept expression that resolves to false are the ones that Mule filtersout.
The example below filters out all records where the age is less than 21; the batch step does not process those records.
<batch:job jobName='batchJob'>
<batch:process-records >
<batch:step name='adultsOnlyStep' acceptExpression='#[payload.age > 21]'>
...
</batch:step>
</batch:process-records>
</batch:job>
Mule Ref Doc :Refining Batch Steps Processing | MuleSoft Documentation
As we are clear with above concepts , now lets understand this solution step by step.
1) Batch Step (Less than 50)
Accept expression for this batch step is less than 50. Hence elements which will go in this batch step are amount value 40 and 2. Hence output of logger in first batch step is
{amount=140}
{amount=102}
2) Batch Step (Greater than 20)
Accept condition for this batch step is greater than 20. Note that input amount values for this batch step are 100 , 140 and 102 (last two values have been updated in batch step less than 50)
As all values satisfy this condition out put of second logger is
{step2amount=100}
{step2amount=140}
{step2amount=102}
Hence correct answer to this question is
{amount=140}
{amount=102}
{step2amount=100}
{step2amount=140}
{step2amount=102}
2) Batch Step (Greater than 20)
Accept condition for this batch step is greater than 20. Note that input amount values for this batch step are 100 , 140 and 102 (last two values have been updated in batch step less than 50)
As all values satisfy this condition out put of second logger is
{step2amount=100}
{step2amount=140}
{step2amount=102}
Hence correct answer to this question is
{amount=140}
{amount=102}
{step2amount=100}
{step2amount=140}
{step2amount=102}
A REST connect module is generated for a RAML specification. and then the rest connect module is imported in mule application in Anypoint Studio. For each method of the RAML specification , what does the REST connect module provide?
Answer : B
Correct answer is an operation. For each method of the RAML specification , REST connect module provide an operation.
Please refer to the below screenshot.