Hello,

I want messages send by producer to the queue to be non persistent.
For this, I'm setting JMSDeliveryMode to DeliveryMode.NON_PERSISTENT.
However, this still makes the message persistent as seen via JMX. Only
calling setDeliveryMode(DeliveryMode.NON_PERSISTENT) makes the message
to be non persistent. I'm using Apache ActiveMQ 4.1.1 with the default
configuration (shipped with distro).

The whole code fragment looks like this:

///
ActiveMQConnectionFactory connectionFactory =  new
ActiveMQConnectionFactory("tcp://localhost:61616");
connection = connectionFactory.createConnection()
connection.start();

session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
Destination destination = session.createQueue("testing.out");
MessageProducer producer = session.createProducer(destination);

Message msg = session.createMessage()
msg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
producer.send(msg);

session.close();
connection.close();
///

The same problem is relevant also for Spring's jmsTemplate. Setting
deliveryPersistent property to false on JmsTemplate bean does not make
outgoing messages non persistent.

Thanks in advance.

Regards,
Dzugas Baltrunas

Reply via email to