This discussion is archived
4 Replies Latest reply: Jan 21, 2013 3:19 AM by nigeldeakin RSS

Why we need to 2 Queues in JMS Server

800839 Newbie
Currently Being Moderated
Hi,

In JMS, why we need to create 2 Queues for SEND and RECEIVE in JNDI? Say I am sending a XML message to SEND QUEUE , when the consumer
retrieve the message he need to look in the SEND QUEUE right? rather than the RECEIVE queue (which is empty)? If that is case why we need to 2
queues to be configured in JMS server? Whether from SEND Queue the message will be transferred to RECEIVE queue to picked by
the consumer?Please clarify.

Thanks.
  • 1. Re: Why we need to 2 Queues in JMS Server
    r035198x Pro
    Currently Being Moderated
    If you are only sending a message to a queue then you need only configure the one queue you are sending to. Similarly if you are only receiving from a queue and not sending to another queue then you only need one queue configured.
    However, if the application that reads the messages you are sending is deployed on the same server then you need 2 configurations, one for your application's send and another to be used by the other application for reading and vice versa. The specifics of how these configurations should be done dependent on your JMS server vendor.
  • 2. Re: Why we need to 2 Queues in JMS Server
    800839 Newbie
    Currently Being Moderated
    Thanks. Eventhough we send and receive the messages which is configured in the same JMS server, how there can be 2 configuration ? As we will send the
    message in SEND_QUEUE and the receiver should receive it from the same SEND_QUEUE right? In whichcase we need the RECEIVE_QUEUE? I am little confused with this? please clarify and thanks for the support.
  • 3. Re: Why we need to 2 Queues in JMS Server
    r035198x Pro
    Currently Being Moderated
    Say you have two applications deployed on the same application server. The first application send a message to a queue. The second application reads those sent messages from the same queue.
    The first application needs a configuration of a sender queue to send the messages.
    The second application needs a configuration for a receive queue.
    The configurations will point to the same queue but will be different configuration types.

    If the sending and receiving is done by the same application (in different classes) then the two different types of configs are required. In this case though sending a message to the queue is not needed as there is no integration requirement
  • 4. Re: Why we need to 2 Queues in JMS Server
    nigeldeakin Explorer
    Currently Being Moderated
    797836 wrote:
    Hi,

    In JMS, why we need to create 2 Queues for SEND and RECEIVE in JNDI? Say I am sending a XML message to SEND QUEUE , when the consumer
    retrieve the message he need to look in the SEND QUEUE right?
    The use case you are describing requires only one queue. If you are sending a message to a queue called "foo", then the consumer will receive it from "foo".

    But the JNDI name of the queue is not the name of the queue.
    rather than the RECEIVE queue (which is empty)? If that is case why we need to 2
    queues to be configured in JMS server? Whether from SEND Queue the message will be transferred to RECEIVE queue to picked by
    the consumer?Please clarify.
    This is just a guess, but are you perhaps configuring two separate objects in JNDI (with different JNDI names) which refer to the same queue in the JMS server? This isn't required but is possible.

    The JNDI name of a queue is not necessarily its "real" name. It's just the location where you have stored an object which contains information about the queue.

    Nigel

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points