0
votes

I am working on a project where I need to consume JMS messages from IBM MQ which is defined in websphere as JNDI.

I have given only the JNDI of a queue (jms/sampleQ). I am trying to connect the Queue from Spring JMS.

Here my question is, whether the QueueConnectionFactory is mandatory to connect the Queue (JNDI) ?

1

1 Answers

2
votes

To get the javax.jms.Queue object from JNDI you do not need to have a QueueConnectionFactory object. They are independent objects looked up from JNDI.

However to actually send or receive messages you need to combined a JMS Queue and a JMS QueueConnectionFactory. The JMS Queue in JNDI can be used with an MQ QueueConnectionFactory no matter how you get hold of it, so it doesn't need to be grabbed from the WAS JNDI namespace, but if you don't get the QueueConnectionFactory from WAS JNDI you'll loose integration with some server functions like the transaction manager. Spring can pick up the QueueConnectionFactory from JNDI as an option.