I have a jms client consuming a message from queue in the activeMQ, but for
some reason, it hangs and throws the following error. I am using ActiveMQ
4.1.  My JMS client is using multiple connections. 

here is pseudo code.
JMSClient extends Thread
{
   public void run()
   {
       ActiveMQConnectionFactory factory = ...
       Connection conn = factory.createQueueConnection();
       QueueSession session = conn.createQueueSession();
       QueueReceiver receiver = session.createReceiver(queue);
       while(true)
       {
            Message m = receiver.receive(1);
            // Receiving a message.
       }


   }
}

for(int i = 0; i < 10; i++)
{
     new JMSClient().start();
}



IllegalStateException: The Consumer is closed at
org.apache.activemq.ActiveMQMessageConsumer.checkClosed(ActiveMQMessageConsumer.java:672)

Does anybody know why it is thrown and how to prevent this error?  

Please correct this if i am using the jms client in a wrong way for
multi-threading.

I am new to the activeMQ.

Thanks.

-- 
View this message in context: 
http://www.nabble.com/ERROR%3A-The-Consumer-is-closed-tp14282085s2354p14282085.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Reply via email to