activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vale80 <valerio.viane...@uniparthenope.it>
Subject javax.jms.IllegalStateException: The producer is closed
Date Fri, 17 Jul 2009 13:21:58 GMT

Hi all,
I am experiencing  the exception “javax.jms.IllegalStateException: The
producer is closed” when I try to publish a new message  in the queue.
I should put in the queue a new message every 10 minutes   (or with an even
lower frequency ) but after the first one, sometimes after a couple of
messages, I got the exception  written above.

Is there any inactivity timeout I have to set on the producer? 

Helps are really appreciated.

best regards

Valerio

This is the code I use to init the queque and to insert messages in it.

****
public void init(String topicName) throws JSSException {
    try {
      
      ActiveMQConnectionFactory factory = new
ActiveMQConnectionFactory(getUrl());
      connection = factory.createConnection();
      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      topic = session.createTopic(topicName);
      publisher = session.createProducer(topic);
      publisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      om = session.createObjectMessage();
    } catch(Exception ex) {
      ……
    }
  }


public void publish(Object msg) throws JSSException {
	
try {
      om.setObject((Serializable)msg);
      publisher.send(om, javax.jms.DeliveryMode.NON_PERSISTENT,
javax.jms.Message.DEFAULT_PRIORITY, MESSAGE_TTL);
    } catch(Exception ex) {
      …..
    }
  }


-- 
View this message in context: http://www.nabble.com/javax.jms.IllegalStateException%3A-The-producer-is-closed-tp24534363p24534363.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message