在 wso2 esb 中处理 jms 消息
processing jms message in wso2 esb
我有 JMS 消息
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<content>
<entry type="1">
<textMessage JMSDeliveryMode="2" JMSDestination="queue:///QUEUE" JMSExpiration="0" JMSMessageID="ID:c3e2d840d8e3c1f14040404040404040cf1eba01c4eff036" JMSPriority="4" JMSRedelivered="false" JMSTimestamp="1434705226223" fromQueue="true" codec="Base64">
<text>dGVzdA==</text>
</textMessage>
</entry>
</content>
但是当我将它拉入 wso2 esb 时,它进入了 soap 信封,我无法在此处检索属性,例如 JMSDestination 等
我想阅读 WSO2 ESB 中的那些细节。有办法吗?
从 JMS 获取消息后,我收到以下 SOAP 消息,它正在记录或 xPath 仅适用于此。
[2015-06-22 11:08:33,632] INFO - LogMediator To: , WSAction: urn:mediate, SOAPA
ction: urn:mediate, MessageID: ID:c3e2d840d8e3c1f14040404040404040cf224f7f3bbf47
25, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv
:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Bod
y>test1</soapenv:Body></soapenv:Envelope>
谢谢
您可以在您的 inSequence 中使用以下代码 select 来自邮件正文的任何信息(即使有用于内部目的的 soap 信封):
<property name="JMSDestination" expression="$body/content/entry/textMessage/@JMSDestination"/>
确认您的消息是使用适当的消息生成器构建的,否则您将看不到消息内容。请参阅此 JMS 代理示例:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="JMSProxyName" transports="jms" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="custom">
<property name="Log JMSDestination" expression="$body/content/entry/textMessage/@JMSDestination"/>
</log>
<drop/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parameter name="transport.jms.Destination">YourQueue</parameter>
</proxy>
我在发送代理中像这样设置 JMS headers。
在接收代理中,您可以使用 get-property 访问 属性,如下例所示。
<log level="custom">
<property name="Autodeploy_TSONL_CreateProxyTarget - Config Params transport intervall "
expression="get-property('transport','TRANSPORT_TRANSFERINTERVALL')"/>
希望对您有所帮助。
我有 JMS 消息
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<content>
<entry type="1">
<textMessage JMSDeliveryMode="2" JMSDestination="queue:///QUEUE" JMSExpiration="0" JMSMessageID="ID:c3e2d840d8e3c1f14040404040404040cf1eba01c4eff036" JMSPriority="4" JMSRedelivered="false" JMSTimestamp="1434705226223" fromQueue="true" codec="Base64">
<text>dGVzdA==</text>
</textMessage>
</entry>
</content>
但是当我将它拉入 wso2 esb 时,它进入了 soap 信封,我无法在此处检索属性,例如 JMSDestination 等
我想阅读 WSO2 ESB 中的那些细节。有办法吗?
从 JMS 获取消息后,我收到以下 SOAP 消息,它正在记录或 xPath 仅适用于此。
[2015-06-22 11:08:33,632] INFO - LogMediator To: , WSAction: urn:mediate, SOAPA
ction: urn:mediate, MessageID: ID:c3e2d840d8e3c1f14040404040404040cf224f7f3bbf47
25, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv
:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Bod
y>test1</soapenv:Body></soapenv:Envelope>
谢谢
您可以在您的 inSequence 中使用以下代码 select 来自邮件正文的任何信息(即使有用于内部目的的 soap 信封):
<property name="JMSDestination" expression="$body/content/entry/textMessage/@JMSDestination"/>
确认您的消息是使用适当的消息生成器构建的,否则您将看不到消息内容。请参阅此 JMS 代理示例:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="JMSProxyName" transports="jms" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="custom">
<property name="Log JMSDestination" expression="$body/content/entry/textMessage/@JMSDestination"/>
</log>
<drop/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parameter name="transport.jms.Destination">YourQueue</parameter>
</proxy>
我在发送代理中像这样设置 JMS headers。
在接收代理中,您可以使用 get-property 访问 属性,如下例所示。
<log level="custom">
<property name="Autodeploy_TSONL_CreateProxyTarget - Config Params transport intervall "
expression="get-property('transport','TRANSPORT_TRANSFERINTERVALL')"/>
希望对您有所帮助。