I want this post to show you how we can use for each component of the OSB 12c to iterate through a list of users.
Suppose we have the payload
and want to log the USER node.
Let’s go through an example and see how For Each component works:
1) Create a Service Bus application with Service Bus project
2) Create a pipeline
3) Double click on the pipeline and drag and drop the pipeline pair node. Drag and drop the For Each component from the component pallet under the Request stage:
4) Configure the For Each properties like below:
Let’s see the properties:
- For Each Value: Configure the variable that need to iterate. In our case we have configured body as we have the payload in our body only.
- Expression: Which node you need to iterate. In our case we have configured ./USERS/USER as we need to iterate each USER node from the payload.
- Value Variable: You can leave it blank, not required.
- Index Variable: This is the variable that keeps the track of current index.
- Counter Variable: This is the variable that contains the total no of nodes available in the payload.