How to create not persistent queues in A-MQ / ActiveMQ ?

Solution Verified - Updated -

Environment

  • JBoss A-MQ 6.x
  • Fuse Message Broker 5.x

Issue

  • Is it possible to create non-persistent queues in A-MQ?
  • Is there any way to say active mq not to use persistence for some queues?
  • We are using EAP 6.3.1 alongwith AMQ 6.10. We would like to implement an non-persistent queue

Resolution

There is no way to configure a specific queue to be non-persistent in A-MQ / ActiveMQ.
Persistence is rather configured at the message level, e.g. using this API

MessageProducer producer = session.createProducer(queue);
producer.setDeliveryMode (DeliveryMode.NON_PERSISTENT);

Alternatively you can specify the persistence of a message as part of the MessageProducer.send() operation.

void MessageProducer.send(Destination destination, 
    Message message,
    int deliveryMode,
    int priority,
    long timeToLive)
    throws JMSException

Diagnostic Steps

For completeness it should be mentioned you have the broker wide option to configure for persistent=false on the broker's xbean element.

<broker xmlns="http://activemq.apache.org/schema/core" ... persistent="false">

However it disables the use of a persistent store such as kahadb and switches to use the memoryPersistenceAdapter, which keeps all messages in memory only. While it achieves a broker where all destinations are non-persistent, it does not explicitly switch on a non-persistent behavior for the destinations, it rather configures for a different message store.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.