Explanation: 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 one acceptExpression and one acceptPolicy attributes to filter records.
Use the acceptExpression attribute 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 filters out.
The example below filters out all records where the age is less than 21; the batch step does not process those records.
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}