How to setup multiple jms listener for a queue !

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to setup multiple jms listener for a queue !

prashant punekar
Hi,

Here is the way we have set up a listener on Ofbiz which listens to the physical jms queue.

        <jms-service name="receiveInvServiceMessenger" send-mode="all">
            <server jndi-server-name="activeMQ"
                    jndi-name="ConnectionFactory"
                    topic-queue="queue/ReceiveInventoryQueue_in"
                    type="queue"
                    username=""
                    password=""
                    listen="true"
                    listener-class="com.pj.integration.netsuite.listeners.ReceiveInventoryQueueListener"/>
        </jms-service>

When I look into the Active MQ, I can see 1 consumer listening to the queue mentioned. How can increase the number to 2 ? How can I have multiple consumers listening to the same queue ?

I tried following two different options which did not work :
1 )

        <jms-service name="receiveInvServiceMessenger" send-mode="all">
            <server jndi-server-name="activeMQ"
                    jndi-name="ConnectionFactory"
                    topic-queue="queue/ReceiveInventoryQueue_in"
                    type="queue"
                    username=""
                    password=""
                    listen="true"
                    listener-class="com.pj.integration.netsuite.listeners.ReceiveInventoryQueueListener"/>
        </jms-service>
        <jms-service name="receiveInvServiceMessenger2" send-mode="all">
            <server jndi-server-name="activeMQ"
                    jndi-name="ConnectionFactory"
                    topic-queue="queue/ReceiveInventoryQueue_in"
                    type="queue"
                    username=""
                    password=""
                    listen="true"
                    listener-class="com.pj.integration.netsuite.listeners.ReceiveInventoryQueueListener"/>
        </jms-service>
2)
        <jms-service name="receiveInvServiceMessenger" send-mode="all">
            <server jndi-server-name="activeMQ"
                    jndi-name="ConnectionFactory"
                    topic-queue="queue/ReceiveInventoryQueue_in"
                    type="queue"
                    username=""
                    password=""
                    listen="true"
                    listener-class="com.pj.integration.netsuite.listeners.ReceiveInventoryQueueListener"/>
        </jms-service>
        <jms-service name="receiveInvServiceMessenger2" send-mode="all">
            <server jndi-server-name="activeMQ"
                    jndi-name="ConnectionFactory"
                    topic-queue="queue/ReceiveInventoryQueue_in"
                    type="queue"
                    username=""
                    password=""
                    listen="true"
                    listener-class="com.pj.integration.netsuite.listeners.ReceiveInventoryQueueListenerNew"/>
        </jms-service>

Regards,
Prashant


________________________________

http://www.mindtree.com/email/disclaimer.html
Reply | Threaded
Open this post in threaded view
|

RE: How to setup multiple jms listener for a queue !

prashant punekar
Hi,

I figured it out that the key to the listener is the combination of jndi-server-name, jndi-name and topic-queue.
Hence I changed the topic-queue pointing to the same physical queue and I got two cosumers listening to the same physical queue.

Hope this is the right approach.

Regards,
Prashant

From: Prashant Punekar
Sent: Wednesday, February 09, 2011 11:37 AM
To: [hidden email]
Subject: How to setup multiple jms listener for a queue !

Hi,

Here is the way we have set up a listener on Ofbiz which listens to the physical jms queue.

        <jms-service name="receiveInvServiceMessenger" send-mode="all">
            <server jndi-server-name="activeMQ"
                    jndi-name="ConnectionFactory"
                    topic-queue="queue/ReceiveInventoryQueue_in"
                    type="queue"
                    username=""
                    password=""
                    listen="true"
                    listener-class="com.pj.integration.netsuite.listeners.ReceiveInventoryQueueListener"/>
        </jms-service>

When I look into the Active MQ, I can see 1 consumer listening to the queue mentioned. How can increase the number to 2 ? How can I have multiple consumers listening to the same queue ?

I tried following two different options which did not work :
1 )

        <jms-service name="receiveInvServiceMessenger" send-mode="all">
            <server jndi-server-name="activeMQ"
                    jndi-name="ConnectionFactory"
                    topic-queue="queue/ReceiveInventoryQueue_in"
                    type="queue"
                    username=""
                    password=""
                    listen="true"
                    listener-class="com.pj.integration.netsuite.listeners.ReceiveInventoryQueueListener"/>
        </jms-service>
        <jms-service name="receiveInvServiceMessenger2" send-mode="all">
            <server jndi-server-name="activeMQ"
                    jndi-name="ConnectionFactory"
                    topic-queue="queue/ReceiveInventoryQueue_in"
                    type="queue"
                    username=""
                    password=""
                    listen="true"
                    listener-class="com.pj.integration.netsuite.listeners.ReceiveInventoryQueueListener"/>
        </jms-service>

2)
        <jms-service name="receiveInvServiceMessenger" send-mode="all">
            <server jndi-server-name="activeMQ"
                    jndi-name="ConnectionFactory"
                    topic-queue="queue/ReceiveInventoryQueue_in"
                    type="queue"
                    username=""
                    password=""
                    listen="true"
                    listener-class="com.pj.integration.netsuite.listeners.ReceiveInventoryQueueListener"/>
        </jms-service>
        <jms-service name="receiveInvServiceMessenger2" send-mode="all">
            <server jndi-server-name="activeMQ"
                    jndi-name="ConnectionFactory"
                    topic-queue="queue/ReceiveInventoryQueue_in"
                    type="queue"
                    username=""
                    password=""
                    listen="true"
                    listener-class="com.pj.integration.netsuite.listeners.ReceiveInventoryQueueListenerNew"/>
        </jms-service>

Regards,
Prashant


________________________________

http://www.mindtree.com/email/disclaimer.html