ActiveMQ
  1. ActiveMQ
  2. AMQ-1142

TemporaryQueue communication not working

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.0
    • Fix Version/s: 5.0.0
    • Component/s: Broker, JMS client
    • Labels:
      None
    • Environment:

      WinXP, Java 1.4.2

      Description

      Assume a (old legacy, yes this is out of date and better solutions are available) point to point architecture:

      Client creates temporary queues and send the queuename to the server by a fixed queue ('command queue')
      Server uses the received queue names to send messages to the client.

      See the attached Code snippets:

      • Start the Server
      • Start the Client
      • The Client creates a temporary queue and sends the name to the server
      • Server receives message and sends a test message back.
      • Client NEVER receives the test message

      This works 100% on IBM MQSeries (the only source diff is the line that has a MQSerie getQueue API call, instead a createQueue, because queus are defined, and not dynamical as in ActiveMQ)

      ActiveMQ LOG information:

      The temporary queue is logged, but later it says that there are no subscriptions

      (..)
      DEBUG AbstractRegion - Adding destination: topic://ActiveMQ.Advisory.Consumer.Queue.ID:TIGER-2615-1170064714906-1:0:1
      DEBUG JournalPersistenceAdapter - Checkpoint done.
      DEBUG TIGER-2615-1170064714906-1:0:1 - No subscriptions registered, will not dispatch message at this time.
      (...)

      Can this bug be fixed?

      Thank you, Jos

        Activity

        Hide
        Jos added a comment -

        EDIT: I use the default activemq.xml (straight of the ZIP-archive) and version 4.1.0 incubator.

        Anyone any thoughts about this issue? Thank you

        Show
        Jos added a comment - EDIT: I use the default activemq.xml (straight of the ZIP-archive) and version 4.1.0 incubator. Anyone any thoughts about this issue? Thank you
        Hide
        Adrian Co added a comment -

        IMHO, I think the appropriate way to accomplish this is to set the JMSReplyTo property of the message with the temporary queue. And upon receipt of the message, get the reply to property and send to that.

        Let me know if that works for you.

        Show
        Adrian Co added a comment - IMHO, I think the appropriate way to accomplish this is to set the JMSReplyTo property of the message with the temporary queue. And upon receipt of the message, get the reply to property and send to that. Let me know if that works for you.
        Hide
        Adrian Co added a comment -

        Also, I'm not sure if this is a bug or not.

        Show
        Adrian Co added a comment - Also, I'm not sure if this is a bug or not.
        Hide
        bhumika thakkar added a comment -

        I came across a similar issue with temporaray queues. The message doesn't get sent in even when I use the replyTo property.

        Here's the test case:

        public void testQueues() {

        final JmsTemplate jmsTemplate = getSpringBean("jms.template.quoteProcessor", JmsTemplate.class);

        try {
        final Connection connection = jmsTemplate.getConnectionFactory().createConnection();
        Session session = connection.createSession(true, 1);
        final Destination destination = session.createTemporaryQueue();

        Thread senderThread = new Thread(new Runnable() {

        public void run() {
        try

        { System.out.println("In Sender Thread"); Session session = connection.createSession(true, 1); session.createProducer(destination).send(session.createTextMessage("my message")); System.out.println("sent message to queue: " + destination); }

        catch (JMSException e)

        { // TODO Auto-generated catch block e.printStackTrace(); }

        }
        });

        senderThread.start();

        Thread.currentThread().sleep(6000);

        Thread receiverThread = new Thread(new Runnable() {

        public void run() {
        try { System.out.println("In Receiver Thread"); Session session = connection.createSession(true, 1); System.out.println("my session: " + session + ", queue: " + destination); MessageConsumer consumer = session.createConsumer(destination); System.out.println("my consumer: " + consumer); Message message = consumer.receive(); System.out.println("Got this message: " + message.toString()); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); }

        }
        });

        receiverThread.start();

        Thread.currentThread().sleep(6000);

        System.out.println("Done!");
        } catch (InterruptedException e)

        { // TODO Auto-generated catch block e.printStackTrace(); }

        catch (JMSException e1)

        { // TODO Auto-generated catch block e1.printStackTrace(); }

        }

        output:

        In Sender Thread
        sent message to queue: temp-queue://ID:shell.dev.norvax.net-53936-1172097041334-2:1:1
        In Receiver Thread
        my session: ManagedSessionProxy { ActiveMQSession

        {id=ID:shell.dev.norvax.net-53936-1172097041334-2:1:3,started=false}

        }, queue: temp-queue://ID:shell.dev.norvax.net-53936-1172097041334-2:1:1
        my consumer: ActiveMQMessageConsumer

        { value=ID:shell.dev.norvax.net-53936-1172097041334-2:1:3:1, started=false }

        Done!

        It did not receive the message.

        Show
        bhumika thakkar added a comment - I came across a similar issue with temporaray queues. The message doesn't get sent in even when I use the replyTo property. Here's the test case: public void testQueues() { final JmsTemplate jmsTemplate = getSpringBean("jms.template.quoteProcessor", JmsTemplate.class); try { final Connection connection = jmsTemplate.getConnectionFactory().createConnection(); Session session = connection.createSession(true, 1); final Destination destination = session.createTemporaryQueue(); Thread senderThread = new Thread(new Runnable() { public void run() { try { System.out.println("In Sender Thread"); Session session = connection.createSession(true, 1); session.createProducer(destination).send(session.createTextMessage("my message")); System.out.println("sent message to queue: " + destination); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); senderThread.start(); Thread.currentThread().sleep(6000); Thread receiverThread = new Thread(new Runnable() { public void run() { try { System.out.println("In Receiver Thread"); Session session = connection.createSession(true, 1); System.out.println("my session: " + session + ", queue: " + destination); MessageConsumer consumer = session.createConsumer(destination); System.out.println("my consumer: " + consumer); Message message = consumer.receive(); System.out.println("Got this message: " + message.toString()); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); receiverThread.start(); Thread.currentThread().sleep(6000); System.out.println("Done!"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JMSException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } output: In Sender Thread sent message to queue: temp-queue://ID:shell.dev.norvax.net-53936-1172097041334-2:1:1 In Receiver Thread my session: ManagedSessionProxy { ActiveMQSession {id=ID:shell.dev.norvax.net-53936-1172097041334-2:1:3,started=false} }, queue: temp-queue://ID:shell.dev.norvax.net-53936-1172097041334-2:1:1 my consumer: ActiveMQMessageConsumer { value=ID:shell.dev.norvax.net-53936-1172097041334-2:1:3:1, started=false } Done! It did not receive the message.
        Hide
        james strachan added a comment -

        You're using transacted mode sessions in that code; so you need to do a session.commit() before the messages are actually sent

        Show
        james strachan added a comment - You're using transacted mode sessions in that code; so you need to do a session.commit() before the messages are actually sent
        Hide
        james strachan added a comment -

        Note that it is outside of the JMS specification and TCK to be able to call Queue.getQueueName() on a temporary queue, pass that String around and be able to call session.createQueue(temporaryQueueName) and be able to get the same temporary queue.

        The real solution to your problem is to use Message.setJMSReplyTo(Destination) which definitely works and is part of the JMS specification.

        Show
        james strachan added a comment - Note that it is outside of the JMS specification and TCK to be able to call Queue.getQueueName() on a temporary queue, pass that String around and be able to call session.createQueue(temporaryQueueName) and be able to get the same temporary queue. The real solution to your problem is to use Message.setJMSReplyTo(Destination) which definitely works and is part of the JMS specification.
        Hide
        james strachan added a comment -

        I've added a test case to demostrate the issue: TemporaryDestinationToFromNameTest

        and its now resolved in 5.0

        Show
        james strachan added a comment - I've added a test case to demostrate the issue: TemporaryDestinationToFromNameTest and its now resolved in 5.0
        Hide
        Colin Ruthven added a comment -

        A consequence of this seems to be that the nice feature of Composite Destinations will not allow a temporary queue in the list.

        Given that Composite Destinations aren't in the spec. anyway, it would be more consistent to allow a temporary queue here as well.

        Could this be done?

        Show
        Colin Ruthven added a comment - A consequence of this seems to be that the nice feature of Composite Destinations will not allow a temporary queue in the list. Given that Composite Destinations aren't in the spec. anyway, it would be more consistent to allow a temporary queue here as well. Could this be done?

          People

          • Assignee:
            Unassigned
            Reporter:
            Jos
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development