blob: bcdaaab701d5fc4d60a0a9f896b9bb81c0ab075b [file] [log] [blame]
<div class="wiki-content maincontent"><p>Durable subscribers behave a little differently across a cluster of ActiveMQ brokers. The two main issues surround messages getting stuck on other brokers in the network after a durable subscriber has disconnected and reconnected to a different broker in the network without fully unsubscribing. The reasons for disconnecting/reconnecting can be voluntary (where the subscriber is using the failover transport), or involuntary (one of the brokers in the cluster fails).</p>
<p>For example, if you have two brokers A and B networked together in both directions to form a cluster, and a durable subscriber connects to broker B, a producer P on broker A will have its messages properly forwarded to broker B and the durable subscriber. However, if the subscriber disconnects and reconnects to broker A, any messages sent by P while the subscriber was away will be stuck on B until the subscriber reconnects to B. </p>
<p>The solution is to use <link><page ri:content-title="Virtual Destinations"></page></link></p>
<p>Virtual topics use queues under the covers and this allows ActiveMQ to treat each subscriber as a plain old Queue subscriber. This allows ActiveMQ to replay messages that have been orphaned on another broker in the cluster using this configuration as explained in the <link><page ri:content-title="Networks of Brokers"></page></link> documentation:</p>
<structured-macro ac:macro-id="ce6314bd-e55b-41ec-933d-471a912c167a" ac:name="code" ac:schema-version="1"><parameter ac:name="">xml</parameter><plain-text-body> &lt;destinationPolicy&gt;
&lt;policyMap&gt;
&lt;policyEntries&gt;
&lt;policyEntry queue="TEST.&gt;" enableAudit="false"&gt;
&lt;conditionalNetworkBridgeFilterFactory replayWhenNoConsumers="true"/&gt;
&lt;/policyEntry&gt;
&lt;/policyEntries&gt;
&lt;/policyMap&gt;
&lt;/destinationPolicy&gt;</plain-text-body></structured-macro>
<p>Also, take a look at <a shape="rect" href="http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/VirtualTopicNetworkClusterReactivationTest.java?view=markup">this unit test to see the full configuration and usage</a></p></div>