Affects Version/s: 3.1.0
Component/s: Core: (other)
Configuration:Show<service name= "MainService" > <inbound> <inbound-endpoint address= "vm://mainService" responseTransformer-refs= "MessageListToResponseBean ResponseBeanToDom" /> </inbound> <outbound> <pass-through-router> <outbound-endpoint address= "vm://otherService" remoteSync= "true" /> </pass-through-router> </outbound> </service> <service name= "OtherService" > <inbound> <vm:inbound-endpoint path= "otherService" remoteSync= "true" /> </inbound> <outbound> <multicasting-router> <outbound-endpoint address= "vm://fooService" remoteSync= "true" /> <outbound-endpoint address= "vm://barService" remoteSync= "true" /> </multicasting-router> </outbound> </service>
MULE-8590 Define behavior to aggregate collections splitted with group size set as unknown MULE-5860 Inserting <collection-splitter /><collection-aggregator /> into a flow produces unexpected results MULE-4112 Collection aggregator router seems to require the inbound-endpoint to be synchronous MULE-6104 request-reply router, collection-splitter and collection-aggregator triplet bug MULE-9601 Collection Aggregator doesn't remove completed groups from object store MULE-4457 getting CopyOnWriteArrayList class cast error when using collection-aggregator-router MULE-6889 Concurrent Modification Exception when using the Async Message Proccessor inside a foreach MULE-5749 Expected size of the number of messages to aggregate being set to -1 when using a jms reply-to channel MULE-7728 Collection aggregator fails with high amount of messages. Default in memory object store is inefficient. MULE-3623 Collection aggregation router IMMEDIATE timeout exception
I have a response transformer (it extends AbstractMessageAwareTransformer) that receives a DefaultMessageCollection object and does some logic before setting the payload to be a pojo. Another transformer then transforms the pojo into a DOM object, which is what the service should return. I can step through the code and this all happens as expected without errors or warnings.
The problem is that instead of then returning the DOM object as the payload (as expected), the service returns the DefaultMessageCollection with the CopyOnWriteArrayList as it's payload. This seems incorrect to me. If I have a response transformer set the payload to a given object, I'd expect that to be what is returned.
I've included a sample config to illustrate what's happening. There are no exceptions thrown. MainService is returning the MuleMessageCollection with an array payload instead of a regular MuleMessage with a DOM payload.
After studying the code I've found that the payload seems to be getting swapped out in the method called on line 333 of DefaultMuleSession:
//RM* This actually performs the function of adding properties from the request to the response
// message I think this could be done without the performance hit.
//Or we could provide a way to set the request message as the OriginalAdapter on the message
//And provide access to the request properties that way
response = OptimizedRequestContext.unsafeRewriteEvent(response);
Looking in the debugger, before this line is invoked, the response object is a DefaultMessageCollection and it's adapter and originalAdapter are both the DefaultMessageAdapter that contain the expected DOM message. After the call the adapter is switched to one that contains the CopyOnWriteArrayList as it's message.
The above call to unsafeRewriteEvent ultimately invokes:
Which then returns a copy of the message generated via this call:
Which makes a copy of the message like so:
Which returns a new DefaultMessageCollection with an unexpected payload:
This is a significant blocker bug for us, so please let me know if there's any additional info I can provide to help.