Hi, just checked the source code and looks like JMSDeliveryMode message header is completely ignored. ActiveMQSession has the following code: protected void send(ActiveMQMessageProducer producer, ActiveMQDestination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException { /* [...]*/ message.setJMSDeliveryMode(deliveryMode); /* [...] */ } And deliveryMode comes from ActiveMQMessageProducer with the Message.DEFAULT_DELIVERY_MODE (which is DeliveryMode.PERSISTENT) or with the value set with setDeliveryMode(int newDeliveryMode), hence no calls to getJMSDeliveryMode() on the message object. Is it expected to be like this or is it most obviously a bug to ignore mandatory JMSDeliveryMode header property? Regards, Dziugas Baltrunas On 8/6/07, Dziugas Baltrunas wrote: > 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 >