activemq-artemisamqdurable-subscription

JBoss AMQ / ActiveMQ Artemis: Pre-configure Durable Subscribers


I have a Red Hat AMQ (which is based on ActiveMQ Artemis) broker and I would like to make use of durable subscription (or equivalent) feature, so that I will have multiple OpenWire JMS subscribers subscribing to the events of our application which will be delivered to them reliably.

I would like to pre-configure subscribers, so to save me trouble in initial application startup. I want to avoid the case for initial application start up where the main application starts running and publishing events before our durable subscribers perform their initial subscription.

I also wants to avoid explicitly ordering start up sequence of my processes.

Is there any way I can pre-configure durable subscribers? In ordinary ActiveMQ (not Artemis), there is feature like Virtual Topics which (kind of) solve the problem.

What is the preferred solution for ActiveMQ Artemis?


Solution

  • It is possible to pre-configure durable subscriptions since the OpenWire implementation creates the queue used for the durable subscription in a deterministic way (i.e. using the format of client-id.subscription-name). For example, if you wanted to configure a durable subscription on the address myAddress with a client-id of myclientid and a subscription name of mysubscription then configure the durable subscription:

    <addresses>
       <address name="myAddress">
           <multicast>
            <queue name="myclientid.mysubscription"/>
          </multicast>
       </address>
    </addresses>