聚合调解员无法正常工作

时间:2014-12-15 12:34:51

标签: wso2esb synapse

我必须汇总两条反馈信息。

这是我的代码:

<?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>
                                

但这不起作用。一旦遇到聚合调解员,它就会停止前进。你能帮帮我,告诉我哪里出错了吗? 在此先感谢:)

2 个答案:

答案 0 :(得分:0)

聚合介体可以与迭代/克隆介体一起使用。你在请求路径中使用它们吗?对于完整条件集min = -1,max = 2

答案 1 :(得分:0)

汇总调解员将收集回复。您无法使用聚合调解器聚合入站请求。请参考[1],这是使用聚合介体+迭代介体的一个很好的例子。 [1] https://docs.wso2.com/display/ESB480/Sample+400%3A+Message+Splitting+and+Aggregating+the+Responses

<definitions xmlns="http://ws.apache.org/ns/synapse">

    <proxy name="SplitAggregateProxy">
        <target>
            <inSequence>
                <iterate expression="//m0:getQuote/m0:request" preservePayload="true"
                         attachPath="//m0:getQuote"
                         xmlns:m0="http://services.samples">
                    <target>
                        <sequence>
                            <send>
                                <endpoint>
                                    <address
                                        uri="http://localhost:9000/services/SimpleStockQuoteService"/>
                                </endpoint>
                            </send>
                        </sequence>
                    </target>
                </iterate>
            </inSequence>
            <outSequence>
                <aggregate>
                    <onComplete expression="//m0:getQuoteResponse"
                                xmlns:m0="http://services.samples">
                        <send/>
                    </onComplete>
                </aggregate>
            </outSequence>
        </target>
    </proxy>
</definitions>