Due to a known issue do not use JDK1.8.0_151 with WSO2 products. Use JDK 1.8.0_144 until JDK 1.8.0_162-ea is released.
This documentation is for WSO2 Message Broker version 3.2.0. For the latest documentation, see the documentation for WSO2 Enterprise Integrator.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Custom JMS property which embeds routing key to the message.

When a message is being sent to the DLC by some means, the user/admin can select messages and redirect them to a different client. In this case, at time the client requires to know the original destination to which the message was publish to.

So from andes-client side, we are The Dead Letter Channel (DLC) is a sub-set of a queue, which is used for storing messages that have not been delivered to the intended subscriber. The DLC provides you the option of deleting these messages, retrieving them or rerouting them to another queue. In the case of rerouting the message to a different queue, the message will be received by the clients subscribed to this second queue. Therefore, since the subscribers of the second queue are not expecting to receive messages from another queue, it will be necessary for such subscriber clients to identify the destination (subscriber) to which the message was originally sent. 

To achieve this, we are using a custom JMS property that embeds the routing key to the message. Wwe are embedding the routing key to a JMS property of the message from the andes-client side. The embedding is enabled only when the AndesSetRoutingKey” system property is set to a non-null value (any value other than null) from in the publisher client side. When the mentioned system property is set, each message will have a JMS property of type string with name the JMS_ANDES_ROUTING_KEYname, which will contain the routing key.

Enabling the JMS property

...

for the publisher

System.setProperty("AndesSetRoutingKey", "1");Getting the property through a JMS message :

Configuring the subscriber client to receive the JMS property

System.out.println("PROP:" + message.getStringProperty("JMS_ANDES_ROUTING_KEY"));