Search code examples
jmsactivemq-classicmessage-queuemessagebrokerjms-topic

ActiveMQ | JMS Properties lost when configuring bridges


In my activemq configuration I want to have an expiration, or time to live, configured for every queue, so I can guarantee that I won't have memory problems in my ActiveMQ broker.

I have three distinct types of publishing configured:

  • Directly publish to a queue;
  • Publish to a topic that is configured as a VirtualTopic, that redirects messages to queues;
  • Publish to a VirtualTopic that redirects to a queue. This queue is then configured as the inbound queue of a JMS bridge, which will then redirect to an outbound queue.

I know that time to live is configured on the publisher side, and I got it working on the first two cases. Although, on the third case I seem to loose this JMS property and I have no expiration configured (on the outbound/final queue of the bridge).

I use Hawtio to see what properties are present on the final queue and I confirmed that the JMSExpiration property is 0, lost on the way. Basically the path and state of the property is as follows:

  1. Virtual Topic: has expiration configured
  2. Inbound queue of the bridge: has expiration configured
  3. Outbound queue of the bridge: Doesn't have expiration configured

The configuration of the bridge is has follows:

<jmsBridgeConnectors>
<jmsQueueConnector outboundQueueConnectionFactory="#localBroker" localQueueConnectionFactory="#localBroker">
    <outboundQueueBridges>

        <outboundQueueBridge
                localQueueName = "CONSUMER.EXAMPLE.INBOUND.QUEUE"
                outboundQueueName = "CONSUMER.EXAMPLE.OUTBOUND.QUEUE"/>

    </outboundQueueBridges>
</jmsQueueConnector>

Do you know if it's normal to lose the JMS properties between a bridge redirection? And if so, how can I configure an expiration or time to live on the outbound queue?

Thanks


Solution

  • I managed to solve my own problem using an existing plugin that basically sets an expiration date to every queue that doesn't have one.

    The configuration looks as follows:

    <plugins>
         <timeStampingBrokerPlugin zeroExpirationOverride="172800000"/>
    </plugins>