WSO2 ESB:聚合后聚合节点丢弃消息 [英] WSO2 ESB : Aggregate node droppping message after aggregation

查看:113
本文介绍了WSO2 ESB:聚合后聚合节点丢弃消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在代理内实现扇出-扇入式分离器EIP:

I am implementing the Fan out -- Fan in splitter EIP inside a proxy , whereby :

                |-----> shoe store-(1-M)-------------
productSearchRq --                                     |-->Rs
                |-----> ack clothes store-(0-1)------

鞋店=数据服务,衣服店= Axis 2服务.

Shoe store = Data service and Clothes store = Axis 2 service .

因此简而言之,我实现了上面的模式;我克隆了请求,发送了请求,获取了响应,然后使用有效负载工厂将其格式化:

So in short I implement the pattern above ; I clone the request , send it , get responses , format them using payloadFactory:

<productDetails>
   <productID>$1</productID>
   <productName>$2</productName>
   <productSize>$3</productSize>
   <productColour>$4</productColour>
   <productType>$5</productType>
   <sourceID>$6</sourceID>
</productDetails>

在两个响应上均

(并在鞋类产品上重复[//productDetails,重复id = iT],因为它是一对多的).然后,在下面的响应处理程序中,我尝试汇总所有这些productDetails.

on both responses ( and iterate [//productDetails , iterate id = iT] on shoe products since it's one to many). Then in the following response handler , I try to aggregate all these productDetails.

<sequence xmlns="http://ws.apache.org/ns/synapse" name="productSearchHandler">
   <log level="custom">
      <property name="pocSearchRsHandlerSeq reached" value="++++++++++++++=========Aggregating now========+++++++++++++++++=="></property>
   </log>
   <aggregate id="iT">
      <completeCondition>
         <messageCount min="-1" max="-1"></messageCount>
      </completeCondition>
      <onComplete xmlns:ns="http://org.apache.synapse/xsd" expression="//productDetails">
         <log level="custom" separator=",">
            <property name="::::" value="======================= Formatting the Aggregated Responses. ==============="></property>
         </log>
         <log level="full"></log>
      </onComplete>
   </aggregate>
   <aggregate>
      <completeCondition>
         <messageCount min="-1" max="-1"></messageCount>
      </completeCondition>
      <onComplete xmlns:ns="http://org.apache.synapse/xsd" expression="//productDetails">
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
                  <soapenv:Body>
                     <prod:productSearchResp> $1                                                                                                </prod:productSearchResp>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args>
               <arg expression="//productDetails" evaluator="xml"></arg>
            </args>
         </payloadFactory>
         <switch source="get-property('CallType')">
            <case regex="SOAP">
               <send></send>
            </case>
            <case regex="REST">
               <property name="messageType" value="application/json" scope="axis2" type="STRING"></property>
               <send></send>
            </case>
            <default></default>
         </switch>
      </onComplete>
   </aggregate>
</sequence>

过滤器在那里可以满足此代理的API实现.而且我确实需要2个聚合器,因为我使用了克隆AND迭代器中介器.

The filter's there to cater for the API implementation of this proxy. And I do need 2 aggregators because I use a clone AND iterator mediator.

所以我想知道为什么在我的第二个聚合器之前,该消息被重置"为空的肥皂消息,因此第二个agg无法找到//productDetails.请参阅以下日志条目:

So I am wondering why before my second aggregator , the message is being "reset" to an empty soap message and therefore the 2nd agg fails to find //productDetails. See following log entries :

在汇总鞋类产品的第一个agg之后:

After 1st agg which aggregates shoe prods:

TID: [0] [ESB] [2015-02-27 09:46:24,520] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} -  Merging message : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><productID>1124596</productID><productName>REEBOK_SNEAKERS</productName><productSize>7</productSize><productColour>BROWN</productColour><productType>SHOES</productType><sourceID>SHC</sourceID></productDetails></soapenv:Body></soapenv:Envelope> using XPath : //productDetails {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
TID: [0] [ESB] [2015-02-27 09:46:24,522] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} -  Merged result : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><productID>1452168</productID><productName>PUMPS</productName><productSize>7</productSize><productColour>ORANGE</productColour><productType>SHOE</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1124596</productID><productName>REEBOK_SNEAKERS</productName><productSize>7</productSize><productColour>BROWN</productColour><productType>SHOES</productType><sourceID>SHC</sourceID></productDetails></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
TID: [0] [ESB] [2015-02-27 09:46:24,523] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} -  Merging message : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><productID>1123456</productID><productName>NIKE_SHIRTS</productName><productSize>7</productSize><productColour>RED</productColour><productType>SHIRT</productType><sourceID>SHC</sourceID></productDetails></soapenv:Body></soapenv:Envelope> using XPath : //productDetails {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
TID: [0] [ESB] [2015-02-27 09:46:24,525] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} -  Merged result : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><productID>1452168</productID><productName>PUMPS</productName><productSize>7</productSize><productColour>ORANGE</productColour><productType>SHOE</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1124596</productID><productName>REEBOK_SNEAKERS</productName><productSize>7</productSize><productColour>BROWN</productColour><productType>SHOES</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1123456</productID><productName>NIKE_SHIRTS</productName><productSize>7</productSize><productColour>RED</productColour><productType>SHIRT</productType><sourceID>SHC</sourceID></productDetails></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}

然后进入第二个步骤:

TID: [0] [ESB] [2015-02-27 09:46:24,545] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} -  Generating Aggregated message from : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><noItemFound>No item in Ackerman's</noItemFound></productDetails></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
TID: [0] [ESB] [2015-02-27 09:46:24,547] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} -  Merging message : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body></soapenv:Body></soapenv:Envelope> using XPath : //productDetails {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
TID: [0] [ESB] [2015-02-27 09:46:24,550] ERROR {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} -  Error evaluating expression: //productDetails {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}

我想要合并

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><productID>1452168</productID><productName>PUMPS</productName><productSize>7</productSize><productColour>ORANGE</productColour><productType>SHOE</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1124596</productID><productName>REEBOK_SNEAKERS</productName><productSize>7</productSize><productColour>BROWN</productColour><productType>SHOES</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1123456</productID><productName>NIKE_SHIRTS</productName><productSize>7</productSize><productColour>RED</productColour><productType>SHIRT</productType><sourceID>SHC</sourceID></productDetails></soapenv:Body></soapenv:Envelope>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><noItemFound>No item in Ackerman's</noItemFound></productDetails></soapenv:Body></soapenv:Envelope>

推荐答案

您好,如果您将克隆介体与一个聚合介体一起使用,则可以聚合来自两个不同服务的响应.查看本教程的工作原理

Hi if you are using clone mediator with one aggregate mediator you can aggregate the response from two different services. check this tutorial how that works

http://architects.dzone.com/articles/wso2-esb-克隆和

这篇关于WSO2 ESB:聚合后聚合节点丢弃消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆