我有代理监听消息代理上的JMS队列.当我将消息发送到队列时,我将自定义属性设置为JMS消息.但是当我记录代理收到的消息时,没有自定义的JMS属性.
我如何在代理中获得自定义JMS属性?
我将WSO2 ESB 4.6.0与ActiveMQ 5.8.0一起使用.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="MyProxy" transports="https,TTP,http,jms" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<log level="full"/>
</inSequence>
<outSequence>
<drop/>
</outSequence>
<endpoint>
<address uri="jms:/MyQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue" format="pox"/>
</endpoint>
</target>
</proxy>
Run Code Online (Sandbox Code Playgroud)
有必要获取传输头以访问自定义JMS属性.我找到了两种方法:
1)来自XML配置:
<log level="custom">
<property name="jms property" expression="get-property('transport', 'custom_prop_key_1')"/>
</log>
Run Code Online (Sandbox Code Playgroud)
2)来自自定义类Mediator:
public boolean mediate(MessageContext synCtx) {
((Map)((Axis2MessageContext) synCtx).getAxis2MessageContext().getProperty("TRANSPORT_HEADERS")).get("custom_prop_key_1");
...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1675 次 |
| 最近记录: |