WSO2聚合介体过早/不完整/未知完成 [英] WSO2 Aggregate Mediator premature/incomplete/unknown completion
问题描述
我在代理的out序列内的聚合介体遇到一个令人困惑的问题.
I'm having a confusing issue with my aggregate mediator inside an out Sequence of a proxy.
配置:
实现迭代介体的序列迭代以下消息:
A sequence implementing the iterate mediator Iterated the following message :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<productSearchRs xmlns="SHC">
<productDetails>
<Product_ID>1487326</Product_ID>
<Product_Name>SECRET</Product_Name>
<Product_Size>M</Product_Size>
<Product_Colour>BLACK</Product_Colour>
<Product_Type>SOCKS</Product_Type>
<Source>SHC</Source>
</productDetails>
<productDetails>
<Product_ID>1985211</Product_ID>
<Product_Name>SECRET</Product_Name>
<Product_Size>M</Product_Size>
<Product_Colour>BLACK</Product_Colour>
<Product_Type>SOCKS</Product_Type>
<Source>SHC</Source>
</productDetails>
</productSearchRs>
</soapenv:Body>
</soapenv:Envelope>
进入这些(在payloadFactory之后):
Into these (after a payloadFactory):
<pfPadding>
<productDetails>
<productID>1487326</productID>
<productName>SECRET</productName>
<productSize>M</productSize>
<productColour>BLACK</productColour>
<productType>SOCKS</productType>
<sourceID>SHC</sourceID>
</productDetails>
</pfPadding>
和
<pfPadding>
<productDetails>
<productID>1985211</productID>
<productName>SECRET</productName>
<productSize>M</productSize>
<productColour>BLACK</productColour>
<productType>SOCKS</productType>
<sourceID>SHC</sourceID>
</productDetails>
</pfPadding>
完整序列:
<sequence xmlns="http://ws.apache.org/ns/synapse" name="shcServiceSearchSeqRs">
<log level="custom">
<property name="Below response recieved from Shc-DS" value="=================="></property>
</log>
<log level="full"></log>
<log level="custom">
<property name="Splitting product_Detail/s up" value="=================="></property>
</log>
<property xmlns:ns1="SHC" xmlns:ns="http://org.apache.synapse/xsd" name="Product_ID" expression="//ns1:productDetails/ns1:Product_ID/text()" scope="default" type="STRING"></property>
<filter xmlns:ns="http://org.apache.synapse/xsd" xpath="boolean(get-property('Product_ID'))">
<then>
<iterate xmlns:ns1="SHC" expression="//ns1:productDetails">
<target>
<sequence>
<property name="Product_ID" expression="//ns1:productDetails/ns1:Product_ID/text()" scope="default" type="STRING"></property>
<property name="Product_Name" expression="//ns1:productDetails/ns1:Product_Name/text()" scope="default" type="STRING"></property>
<property name="Product_Size" expression="//ns1:productDetails/ns1:Product_Size/text()" scope="default" type="STRING"></property>
<property name="Product_Colour" expression="//ns1:productDetails/ns1:Product_Colour/text()" scope="default" type="STRING"></property>
<property name="Product_Type" expression="//ns1:productDetails/ns1:Product_Type/text()" scope="default" type="STRING"></property>
<property name="Source" expression="//ns1:productDetails/ns1:Source/text()" scope="default" type="STRING"></property>
<log level="full"></log>
<log level="custom">
<property name="shcRs : P_ID : " expression="$ctx:Product_ID"></property>
<property name="shcRs : P_Name : " expression="$ctx:Product_Name"></property>
<property name="shcRs : P_Size : " expression="$ctx:Product_Size"></property>
<property name="shcRs : P_Colour : " expression="$ctx:Product_Colour"></property>
<property name="shcRs : P_Type : " expression="$ctx:Product_Type"></property>
<property name="shcRs : P_Source : " expression="$ctx:Source"></property>
</log>
<payloadFactory media-type="xml">
<format>
<productDetails xmlns="">
<productID>$1</productID>
<productName>$2</productName>
<productSize>$3</productSize>
<productColour>$4</productColour>
<productType>$5</productType>
<sourceID>$6</sourceID>
</productDetails>
</format>
<args>
<arg expression="$ctx:Product_ID" evaluator="xml"></arg>
<arg expression="$ctx:Product_Name" evaluator="xml"></arg>
<arg expression="$ctx:Product_Size" evaluator="xml"></arg>
<arg expression="$ctx:Product_Colour" evaluator="xml"></arg>
<arg expression="$ctx:Product_Type" evaluator="xml"></arg>
<arg expression="$ctx:Source" evaluator="xml"></arg>
</args>
</payloadFactory>
<log level="custom">
<property name="Iterated Message : : :" value="++++++++++++++===================================================+++++++++++++++++=="></property>
</log>
<log level="full"></log>
<sequence key="conf:/pocSearchRsHandlerSeq"></sequence>
</sequence>
</target>
</iterate>
</then>
<else>
<payloadFactory media-type="xml">
<format>
<productDetails xmlns="">
<noItemFound>No item in ShoeCity</noItemFound>
</productDetails>
</format>
</payloadFactory>
<sequence key="conf:/pocSearchRsHandlerSeq"></sequence>
</else>
</filter>
</sequence>
这是我的响应处理程序:
Here's my Response handler :
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="pocSearchRsHandlerSeq">
<log level="custom">
<property name="pocSearchRsHandlerSeq reached" value="++++++++++++++=========Aggregating now========+++++++++++++++++=="/>
</log>
<aggregate>
<completeCondition>
<messageCount min="-1" max="-1"/>
</completeCondition>
<onComplete xmlns:ns="http://org.apache.synapse/xsd" expression="//productDetails">
<log level="custom" separator=",">
<property name="::::" value="======================= Formatting the Aggregated Responses. ==============="/>
</log>
<log level="full"/>
</onComplete>
</aggregate>
<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 xmlns:ns="http://org.apache.synapse/xsd" evaluator="xml" expression="//productDetails"/>
</args>
</payloadFactory>
<log level="custom">
<property name="Full Rs Message : : : " value="++++++++++++++===================================================+++++++++++++++++=="/>
</log>
<respond/>
</sequence>
此序列还从另一个序列接收消息,该消息确实会聚合(有时)
This sequence also receives another message from a different sequence which it does aggregate (sometimes)
以下是一些答复(全部来自同一请求)
Here are some responses (all from same request)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp>
<productDetails>
<productID>2145627</productID>
<productName>NIKE_SHIRTS</productName>
<productSize>7</productSize>
<productColour>RED</productColour>
<productType>SHIRT</productType>
<sourceID>ACK</sourceID>
</productDetails>
<productDetails>
<productID>1452168</productID>
<productName>PUMPS</productName>
<productSize>7</productSize>
<productColour>ORANGE</productColour>
<productType>SHOE</productType>
<sourceID>SHC</sourceID>
</productDetails>
</prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp></prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp>
<productDetails>
<productID>1452168</productID>
<productName>PUMPS</productName>
<productSize>7</productSize>
<productColour>ORANGE</productColour>
<productType>SHOE</productType>
<sourceID>SHC</sourceID>
</productDetails>
<productDetails>
<productID>2145627</productID>
<productName>NIKE_SHIRTS</productName>
<productSize>7</productSize>
<productColour>RED</productColour>
<productType>SHIRT</productType>
<sourceID>ACK</sourceID>
</productDetails>
<productDetails>
<productID>1124596</productID>
<productName>REEBOK_SNEAKERS</productName>
<productSize>7</productSize>
<productColour>BROWN</productColour>
<productType>SHOES</productType>
<sourceID>SHC</sourceID>
</productDetails>
</prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
我主要是得到空响应,我在日志中注意到这些在日志中包含以下行,而其他(非空)行则没有:
I mainly get the empty response back , I noticed in the logs that these have the following line in the log where the others(non-empty) don't:
TID: [0] [ESB] [2015-01-16 16:00:15,770] DEBUG {org.apache.synapse.registry.AbstractRegistry} - Cached object has expired for key : conf:/ackServiceSearchSeqRs {org.apache.synapse.registry.AbstractRegistry}
TID: [0] [ESB] [2015-01-16 16:00:15,770] DEBUG {org.apache.synapse.registry.AbstractRegistry} - Expired version number is same as current version in registry {org.apache.synapse.registry.AbstractRegistry}
使用带有序列键的发送"调解器和序列"调解器有什么区别?
What is the difference between using a "send" mediator with a sequence key and a "sequence" mediator?
此外,我是否可以使用单个聚合"节点可靠地聚合一个序列中迭代"的响应以及不同序列的响应?似乎我的聚合节点在收集我的所有响应之前过早地完成",因此执行了我的send/respond(这里有区别吗?)中介器.因为我在文档中注意到了这一点:
Also , can I use a single "aggregate" node to aggregate responses from an "iterate" in one sequnece AND responses from a different sequence , reliably? It seems my aggregate node is prematurely "completing" before collecting all of my responses , and therefore executing my send/respond(any difference here?) mediator. Because I noticed this in the documentation :
Note that when the Iterate mediator is used to split the requests and produces only an n number of fragmented messages, the Aggregate mediator will terminate as soon as it receives n responses, even if you have specified a higher minimum limit.
启用可靠的消息传递会给我带来其他各种问题.
Enabling reliable messaging gives me all sorts of other problems.
推荐答案
我这样解决了它:
事实证明,我需要一个特定的聚合器来聚合我的迭代消息(分别通过迭代/聚合节点上的id属性进行链接),然后再使用另一个聚合器来聚合其他响应以及上述响应(已经聚合的响应)
Turns out I needed a specific aggregator to agg my iterated messages (linked through the id attribute on the iterate/aggregate nodes respectively), then another to aggregate the other response as well as the above (already aggregated responses)
我的响应处理程序:
<sequence xmlns="http://ws.apache.org/ns/synapse">
<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>
<respond></respond>
</onComplete>
</aggregate>
</sequence>
这篇关于WSO2聚合介体过早/不完整/未知完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!