The following code creates a consumer and registers to a queue:Producer producer = null;Session session = null;try { PooledConnectionFactory factory = new PooledConnectionFactory(BROKER_URL); Connection connection = factory.createConnection(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destQueue = new ActiveMQQueue(queue); producer = session.createProducer(destQueue);} finally { if (producer != null) producer.close(); if (session != null) session.close();}The problem is that we occasionally get 'Producer is closed' exception:javax.jms.IllegalStateException: The producer is closed at org.apache.activemq.ActiveMQMessageProducer.checkClosed(ActiveMQMessageProducer.java:196) at org.apache.activemq.ActiveMQMessageProducer.getDestination(ActiveMQMessageProducer.java:153) at org.apache.activemq.jms.pool.PooledProducer.(PooledProducer.java:43) at org.apache.activemq.jms.pool.PooledSession.createProducer(PooledSession.java:361)We are using PooledConnectionFactory. Restarting the application reestablishes the connection and messages are drained correctly. Is there a way to check if the producer has been closed and refresh the connection? What is the root cause of the issue?
-- View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-how-to-deal-with-producer-is-closed-tp4707279.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.