tags:

views:

63

answers:

2

Hi, I have tried to create and use a TemporaryQueue in JMS. My producer succeeds but my consumer fails at this like, with the following error. I understand that this question may require the full code, but it is very lengthly and I am sure no one wants to sort though that. However, if the answer is not so obvious from what I have given here, please feel free to point me to any resources that deal with TemporaryQueues or TempTopics, thank you.'

[Edit] I forgot to attach the code and error:

Code causing error:

QueueReceiver myRecv = mySession.createReceiver(myQueue);

Error:

CWSIA0086E: Failed to create a MessageConsumer for queue://_Q_CBF079A6A1E3018A0000000000262775?busName=myBus2
    at com.ibm.ws.sib.api.jms.impl.JmsMsgConsumerImpl.createCoreConsumer(JmsMsgConsumerImpl.java:689)
    at com.ibm.ws.sib.api.jms.impl.JmsMsgConsumerImpl.<init>(JmsMsgConsumerImpl.java:391)
    at com.ibm.ws.sib.api.jms.impl.JmsQueueReceiverImpl.<init>(JmsQueueReceiverImpl.java:58)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.instantiateConsumer(JmsQueueSessionImpl.java:203)
at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.createConsumer(JmsSessionImpl.java:950)
at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.createConsumer(JmsSessionImpl.java:900)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.createReceiver(JmsQueueSessionImpl.java:123)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.createReceiver(JmsQueueSessionImpl.java:100)
A: 

According to the J2EE 1.4 documents:

A TemporaryQueue object is a unique Queue object created for the duration of a Connection. It is a system-defined queue that can be consumed only by the Connection that created it.

I suspect you are trying to consume from a different connection.

thixo
A: 

It seems as though you are doing this in the wrong order. Typically the consumer creates the temporary queue by opening it for input and then uses that object to fill in the Reply-To fields on a request message. The service provider application listens on a pre-defined, well-known queue for the request message and then uses the Reply-To fields from the request to address the response. In this way the producer app discovers the dynamic queue based on the request received.

Dynamic queues are generally not used as the destination for a request or datagram message. These use cases call for a pre-defined, well-known queue which the consumer listens on. Dynamic queues are almost always for the reply message in a request-reply exchange.

T.Rob