Search code examples
jmswebsphere

Getting the Queue name from within the MDB


I have 2 Websphere application Server(WAS) applications, one sending a message and the other reading and processing it . I need the queue name to be known in the reading application for my downstream processing. I am trying to get the queue name (in the reading application) by using the following code . But however I get NullPointerException since the getJMSDestination is returning null.

Queue queue = (Queue)message.getJMSDestination();
logger.info("Queue ID: "+queue.getQueueName());

Note that the queue name is set via the destination object in the sending application. Is there any other parameters that I am missing to set in the sending application ?


Solution

  • The message should have the destination stored in its JMSDestination property, you can try fetch that instead of using getJMSDestination()