Skip to main content

From what I have understood, the variables tied to the thread will be lost once the time based or size based aggregation is done and the flow that gets triggered by aggregator-listener runs on a  brand new thread with no connection to original request and variables reset to defaults. In our case, we have an exp api, that in turn is calling 2 other process api and this inturn is calling a system api that has time based aggregator with timeout period of 15 mins. In order to track this transaction end to end, we have introducted tracker fields like correlation Id, businessObjectKey etc., But these are getting lost once the aggregator listener triggers the flow, what is the best way to retain the tracker fields   

2 answers
  1. Apr 24, 11:31 AM

     The best way to retain tracking fields like CorrelationId while using a time-based aggregator and aggregator listener in MuleSoft is to explicitly persist and propagate the value as part of the aggregated payload or metadata, rather than relying on flow variables alone (since they are not automatically preserved across aggregation boundaries). Typically, you should include the CorrelationId in the message payload, attributes, or as a custom object before aggregation, and configure the aggregator to group based on that CorrelationId. When the aggregator completes, ensure the aggregated result still contains this field so that the aggregator listener can access it. A common and reliable approach is to store the CorrelationId in an Object Store or external persistence if needed for long-running aggregations, and always map it back into the final message structure, ensuring end-to-end traceability across asynchronous processing. 

0/9000