Greetings:

   I am seeing some very weird behavior when using some temporary topics to
receive messages.

1. I am creating a temporary topic

           Topic temp = mySession.createTemporaryTopic();

2. I then create MessageConsumer object to receive messages on this
temporary topic

           MessageConsumer reply = mySession.createConsumer(temp);

3. Later on (after doing some other things, including sending a message on a
*different* topic) I attempt to receive a message using the temporary topic:

                ObjectMessage obj = (ObjectMessage )reply.receive(DEF_TIMEOUT);


   I am doing all of this in the same application, in a method called
"sendRequest()" (it is part of a request- response system, where the
temporary topic will receive the responses and another more permanent topic
will publish the requests. This method basically creates the temporary topic
and sets it up to be *synchronous* (note that there is *no* MessageListener
set!). 

   The first time I run the sendRequest() method, the consumer I create for
the temporary topic receives the response without problems.

   The second time I call this method, however, any attempt to do a receive
on the *newly created temporary topic*, I get the following exception
thrown:

javax.jms.IllegalStateException: Cannot synchronously receive a message when
a MessageListener is set

   This makes no sense, of course, because Each time I call sendRequest() I
create a new temporary topic and a consumer for that temporary topic and I
*do not* set any listeners on the consumer!

   In fact, whilst stepping through my code, I *check* the Consumer for the
temporary topic I create as well as the Session object. Neither of them has
any listeners! Of course they shouldn't, but my check confirms that they
don't!

   Can anyone give insights as to why the  is behaving in such a manner?
More important: how can I stop this behavior???















ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
-- 
View this message in context: 
http://www.nabble.com/Weird-problem-using-temporary-topic-tp17440381s2354p17440381.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to