Reputation: 115
I have a situation where I am using Batch to process the records.
Each records contains a sub-records which I have to sum up for all records.
For now what I am doing is at each batch step,I am reading the no. of sub-records & storing it in some flow variable say "counter". In this Batch step only I am adding this counter to another flow variable say "total_count". But at this total_count does not remain persistent. For each record, this total_count set to 0 as it is been initialized at the start of the flow. I set total_count as session variable & Property as well. but It gives same result.
I want total count this sub-record. What approach I should use? How can I increase the value of total_count as per each record.
Thanks.
Upvotes: 0
Views: 1646
Reputation: 1
Here is a similar question
Mule ESB How to implement a counter variable to count how much times a flow is called
If you need to store runtime data that is available across the application, you can store the data as objects in the Registry. Here is an example
muleContext.getRegistry().registerObject("Count", new Integer(14))
Upvotes: 0
Reputation: 2832
Please try to persist the count in record variable.It should be available and persist across batch records.Please refer link below
Upvotes: 0