<div class="wiki-content maincontent"><structured-macro ac:macro-id="fcf7d983-a1c8-45c4-97f5-e84d80c6cb5e" ac:name="info" ac:schema-version="1"><parameter ac:name="title">Inactive Destination</parameter><rich-text-body>An 'inactive' destination is one that has had no messages pending and no consumers connected for some configured period of time.</rich-text-body></structured-macro><structured-macro ac:macro-id="44b9356b-6be3-4fbf-87d6-7c0840678f48" ac:name="info" ac:schema-version="1"><rich-text-body>By default the broker does <em>not</em> check for inactive destinations. This as governed by the default values for the following options: <strong><code>schedulePeriodForDestinationPurge="0"</code></strong> and <strong><code>gcInactiveDestinations="false"</code></strong>.</rich-text-body></structured-macro><p>However, the broker can be configured to purge inactive destinations. To do so requires using specially configured destination policy entries in combination with the broker attribute: <strong><code>schedulePeriodForDestinationPurge > 0</code></strong>.</p><p>Example:</p><structured-macro ac:macro-id="6500de46-5edd-41a6-8032-baf0dc981af5" ac:name="code" ac:schema-version="1"><parameter ac:name="language">xml</parameter><plain-text-body><broker xmlns="http://activemq.apache.org/schema/core" schedulePeriodForDestinationPurge="10000"> | |
<destinationPolicy> | |
<policyMap> | |
<policyEntries> | |
<policyEntry queue=">" gcInactiveDestinations="true" inactiveTimoutBeforeGC="30000"/> | |
</policyEntries> | |
</policyMap> | |
</destinationPolicy> | |
</broker></plain-text-body></structured-macro><p>In this example the broker will check for inactive destinations every <strong><code>10</code></strong> seconds, as determined by <strong><code>schedulePeriodForDestinationPurge="10000"</code></strong>. When a destination purge is triggered the broker will delete any queue that has been empty for longer than <strong><code>inactiveTimoutBeforeGC="30000"</code></strong> milliseconds (default: <strong><code>60000</code></strong> milliseconds) and for which <strong><code>gcInactiveDestinations="true"</code></strong> is set on its corresponding destination policy entry.</p><p>When a destination is removed the broker will log a message like:</p><structured-macro ac:macro-id="af51b539-e8e4-4614-88fb-8c56e9030c99" ac:name="code" ac:schema-version="1"><plain-text-body>INFO Queue - TEST.QUEUE Inactive for longer than 30000 ms - removing ...</plain-text-body></structured-macro><p> </p><p> </p></div> | |