我有这个代理服务将两个 xml 消息聚合为一个。
- 我已经用 xpath 配置了我的聚合器类
- 我不确定我的带命名空间的 xpath 是否有效。我无法用日志追踪。
我的代理配置:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="prescription"
transports="https http jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<aggregate>
<completeCondition>
<messageCount min="2" max="2"/>
</completeCondition>
<onComplete expression="//soapenv:Envelope//f:Prescription//f:identifier//f:id//@value">
<send>
<endpoint>
<address uri="jms:/report?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/>
</endpoint>
</send>
</onComplete>
</aggregate>
</inSequence>
<outSequence>
<drop/>
</outSequence>
<faultSequence/>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
我的输入消息如下所示:(我想根据患者 ID 进行汇总)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://isova.wipro.com/">
<Prescription xmlns="http://hl7.org/fhir">
<identifier>
<id value="A0001"/>
</identifier>
<status value="active"/>
<patient>
<type value="Patient"/>
<url value="Bhavani"/>
</patient>
<prescriber>
<type value="Provider"/>
<url value="Dr.Mathews"/>
</prescriber>
<medicine>
<identification>
<text value="Zintac"/>
</identification>
</medicine>
</Prescription></soapenv:Envelope>
有什么建议么 ?
问候大师@gnanagurus
我无法帮助解决这个问题。这是我最新的 WSO2 代理。
这是“处方”队列中存在的两条消息。
消息1:
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://isova.wipro.com/">
<Prescription xmlns="http://hl7.org/fhir">
<identifier>
<id value="A0001"/>
</identifier>
<status value="active"/>
<patient>
<type value="Patient"/>
<url value="Bhavani"/>
</patient>
<prescriber>
<type value="Provider"/>
<url value="Dr.Mathews"/>
</prescriber>
<medicine>
<identification>
<text value="Zintac"/>
</identification>
</medicine>
</Prescription></soapenv:Envelope></soapenv:Body></soapenv:Envelope>
消息 2:
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://isova.wipro.com/">
<Prescription xmlns="http://hl7.org/fhir">
<identifier>
<id value="A0001"/>
</identifier>
<status value="active"/>
<patient>
<type value="Patient"/>
<url value="Bhavani"/>
</patient>
<prescriber>
<type value="Provider"/>
<url value="Dr.John"/>
</prescriber>
<medicine>
<identification>
<text value="tintac"/>
</identification>
</medicine>
</Prescription></soapenv:Envelope></soapenv:Body></soapenv:Envelope>
代理人:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="prescription"
transports="https http jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<aggregate>
<completeCondition>
<messageCount min="2"/>
</completeCondition>
<onComplete expression="/Prescription">
<send>
<endpoint>
<address uri="jms:/report?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/>
</endpoint>
</send>
</onComplete>
</aggregate>
</inSequence>
<outSequence>
<drop/>
</outSequence>
<faultSequence/>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
这并没有解决我的聚合问题。这两条消息没有得到聚合器。我尝试使用多个带有命名空间的 xpath。非常需要任何帮助。
是否有任何 WSO2 Aggregator 自定义 java 类可以用来代替聚合中介?
问候大师