1
votes

I have proxy that listens to JMS queue on message broker. When I send the message to a queue, I set custom properties to JMS message. But when I log the message received by the proxy, there is no custom JMS properties.
How would I get custom JMS properties in proxy?

I use WSO2 ESB 4.6.0 with 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>
2

2 Answers

3
votes

I do not think they are available in the SOAP message directly. They should be available in Axis2 / Transport scope. Usually JMS transport add only the JMS message's payload to SOAP body. So please try following.

Can you check them retrieving using properties in ESB and log them.

<log level="custom">
    <property name="JMS_PROPERTY---->" expression="get-property('axis2','your-property-name')"/>
</log>

You can refer this on scope of properties. (If it is set at Transport headers you can change scope from 'axis2' to 'transport' and try.)

I have not personally tried this and suggesting the answer logically.

6
votes

It is necessary to get transport headers in order to access custom JMS properties. I've found 2 ways for that:
1) from XML configuration:

<log level="custom">            
    <property name="jms property" expression="get-property('transport', 'custom_prop_key_1')"/>            
</log>

2) from custom Class Mediator:

public boolean mediate(MessageContext synCtx) {
    ((Map)((Axis2MessageContext) synCtx).getAxis2MessageContext().getProperty("TRANSPORT_HEADERS")).get("custom_prop_key_1");
...
}