Camilo Crespo
Camilo Crespo

Reputation: 615

Websphere MQ: Proper usage of method createQueue(java.lang.String queueName) in com.ibm.mq.jms.MQSession

I need to clarify the behavior of the method createQueue(java.lang.String queueName) from the class com.ibm.mq.jms.MQSession. If I pass an arbitrary queue name, will it create a temporary queue? In the other hand, what String value needs to be passed to get a Queue object that represents a static queue configured in the queue manager? For instance, if I have an object dest of type MQDestination, I could call dest.toString() or according to javadocs or dest.getStringFromDestination() (which returns a URI String). Will any of these two results work if passed to the createQueue method mentioned.

The intent of my question is to properly use a Spring's DynamicDestinationResolver (takes String and returns Destination) which behind the scenes uses this MQ specific method.

Thanks for your time

Upvotes: 0

Views: 837

Answers (1)

Tim McCormick
Tim McCormick

Reputation: 956

You can find the description of the JMS Session object here:

http://docs.oracle.com/javaee/7/api/javax/jms/Session.html

In JMS Session.createQueue() does not create a physical queue on the MQ queue manager, rather it's used to connect to one which has already been defined. MQSession.createQueue("Q1"); would result in a Destination object which can be used to refer to the queue 'Q1' which already exists on the queue manager.

For creating a temporary queue you need to use the createTemporaryQueue() method of the MQSession object. Though you have no control over the name of said temporary queue.

Upvotes: 1

Related Questions