Atomikos Forum

Webpshere MQ - CreateConsumer Issue

using TransactionEssentials-3.5.5.jar

I had come across a problem with Webspher MQ 6.x version and it seems like creation of MessageCosumer fails in MessageConsumerSession.java with the following error:

************
09-07-21 10:26:46,171 [Thread-4] Failed to create MessageConsumer: null
javax.jms.IllegalStateException: MQJMS1112: JMS1.1 Invalid operation for domain specific object
    at com.ibm.mq.jms.MQQueueSession.createConsumer(MQQueueSession.java:398)
    at com.ibm.mq.jms.MQXAQueueSession.createConsumer(MQXAQueueSession.java:508)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.atomikos.jms.AtomikosJmsXaSessionProxy.invoke(AtomikosJmsXaSessionProxy.java:115)
    at $Proxy2.createConsumer(Unknown Source)
    at com.atomikos.jms.extra.MessageConsumerSession$ReceiverThread.refresh(MessageConsumerSession.java:372)
    at com.atomikos.jms.extra.MessageConsumerSession$ReceiverThread.run(MessageConsumerSession.java:445)
09-07-21 10:26:46,186 [Thread-4] MessageConsumerSession: Error in JMS thread
***************

The handling of NoLocalFlag in the case of Queue is not handled properly in websphere MQ.

As per JMS 1.1 spec:
public MessageConsumer createConsumer(Destination destination,
                                      String messageSelector,
                                      boolean NoLocal)
                              throws JMSException

NoLocal - - if true, and the destination is a topic, inhibits the delivery of messages published by its own connection. The behavior for NoLocal is not specified if the destination is a queue.

So the following code in MessageConsumerSession results in the above error:

if ( subscriberName == null ) ret = session.createConsumer ( destination, getMessageSelector () , getNoLocal() );
                else ret = session.createDurableSubscriber( ( Topic ) destination , subscriberName , getMessageSelector() , getNoLocal() );

Can we modify the above code to make the decision based on whether the Destination is a queue (or) topic. such as

if (destination instanceof Topic) ret = session.createConsumer(destination, getMessageSelector() , getNoLocal()); else ret =
session.createConsumer(destination, getMessageSelector());

Thanks.
Muthuvelan Swaminathan Send private email
Tuesday, July 21, 2009
 
 
Oh I meant ...

if (destination instanceof Topic) session.createDurableSubscriber( ( Topic ) destination , subscriberName , getMessageSelector() , getNoLocal() );
else ret =
session.createConsumer(destination, getMessageSelector());
Muthuvelan Swaminathan Send private email
Tuesday, July 21, 2009
 
 
Thanks for the input!

Looks like this makes sense - we'll schedule this for a future release.

Guy
Guy Pardon Send private email
Friday, July 24, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics