1 2 Previous Next 17 Replies Latest reply on Sep 2, 2010 6:35 AM by ynusis Go to original post
      • 15. Re: Responses without requests to a temporary queue
        ynusis

        So, finally I did it as desribed in my first posting.

         

        Thanks for your help.

        • 16. Re: Responses without requests to a temporary queue
          andreas_back

          Hello Michael,

           

          thank you for sharing your solution!

           

          So you are using a temporary queue created by the client, persist it one server and use it to send messages to the client.

           

          Two questions come into my mind:

           

          *     How do you persist the temporary queues - as serialized objects, into an OODB or as BLOBS into a relational DB?

          *     How do you check that the clients sessions/connection that has created the temporary queue is still alive?

           

          With best regards,

           

          Andreas

          • 17. Re: Responses without requests to a temporary queue
            ynusis

            hopefully not too late...

            *     How do you persist the temporary queues - as serialized objects, into an OODB or as BLOBS into a relational DB?

             

            // Serverside: persisting the queue

            Message message = ...;

            HornetQTemporaryQueue q = (HornetQTemporaryQueue) message.getJMSReplyTo();

            String persistedQueue = q.getAddress(); // something like: jms.tempqueue-93478934789-c435f-234f-7sfh-2348sdfsh3478

            persist(user, persistedQueue); // pseudo code

             

            // Serverside: loading the queue

            Session session = ...;

            String persistedQueue  = getPersistedQueue(user); // pseudo code

            MessageProducer producer = session.createProducer(HornetQTemporaryQueue.fromAddress(persistedQueue));

            producer.send(...);

             

            For a more detailed post see my initial thread post.

            *     How do you check that the clients sessions/connection that has created the temporary queue is still alive?

            Fortunately HornetQ is able to tell you this. You can specify a special notification topic (http://hornetq.sourceforge.net/docs/hornetq-2.1.2.Final/user-manual/en/html/management.html#management.notifications) where you receive events like:

            _HQ_NotifyType=CONSUMER_CREATED

            _HQ_NotifyType=CONSUMER_CLOSED

            1 2 Previous Next