Search code examples
apache-synapsewso2-esb

Aggregate mediator is not working


I have to aggregate two reponse messages.

Here is my code:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="AggregateMediator"
       transports="jms"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log>
            <property name="hi" value="start*************************"/>
         </log>
         <aggregate>
            <completeCondition>
               <messageCount min="2" max="2"/>
            </completeCondition>
            <onComplete expression="//OutboundGTMXML">
               <send>
                  <endpoint>
                     <address uri="jms:/aggregateReciever?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61616&amp;transport.jms.DestinationType=queue"/>
                  </endpoint>
               </send>
            </onComplete>
         </aggregate>
      </inSequence>
   </target>
   <parameter name="transport.jms.ContentType">
      <rules>
         <jmsProperty>contentType</jmsProperty>
         <default>application/xml</default>
      </rules>
   </parameter>
   <parameter name="transport.jms.Destination">aggregateSender</parameter>
   <description/>
</proxy>
                                

But this is not working. It stops going further as soon as it encounters aggregate mediator. Can you please help me and tell me where am I going wrong? Thanks in advance :)


Solution

  • Aggregate mediator can be used with iterate /clone mediators. Do you use them in the request path? For the complete condition set min=-1, max=2