1 2 Previous Next 17 Replies Latest reply on Sep 2, 2010 6:35 AM by Michael Wittig

    Responses without requests to a temporary queue

    Michael Wittig Newbie

      Hi everybody,


      I run into several questions implementing a request / response system where the response is not send immediately after the request or responses are send without a request. So I can't use the JMSReplyTo() because sometime there is no request but i habe to send a response.

      It is very important that the answer is only send to the client who made the request, so I can't use a public destination for all responses.


      I figured out, that I can use the following code to "persist" the clients temporary queue on the server side although the Queue itself is not serializable:


      The very first message send by the client contains a JMSReplyTo() pointing to a temporary queue created by the client.


      // [...]

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

      String persistedQueue = q.getAddress();

      persist(user, persistedQueue); // pseudo code

      // [...]


      All the following responses are send using this snippet:


      // […]

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

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


      // [...]



      My questions are:

      1.) Is this a good idea at all?

      2.) Is there a standard JMS way doing this? My solution is HornetQ specific.

      3.) Is the scenario described above an issue that should be solved with JMS? Maybe I am just trying to abuse JMS?


      A completely other idea:

      Is it possible to have server-side selectors for each client based on JAAS? So I could use a public topic for the answers while clients are separated by there automatically generated selectors?





        1 2 Previous Next