We support a number of different policies which can be attached to individual destinations (queues, topics) or to wildcards of queue/topic hierarchies. This makes it easy to configure how different regions of the JMS destination space are handled.

The properties you can set on a Destination are as follows:

property default description
producerFlowControl true the producer will slow down and eventually block if no resources(e.g. memory) are available on the broker. If this is off messages get off-lined to disk to prevent memory exhaustion
enableAudit true tracks duplicate messages (which can occur in failover for non-persistent messages)
useCache true persistent messages are cached for fast retrieval from store
maxPageSize 200 maximum number of persistent messages to page from store at a time
maxBrowsePageSize 400 maximum number of persistent messages to page from store for a browser
memoryLimit n/a The memory limit for a given destination. This acts as a child to the overall broker memory specified by the <systemUsage>'s memoryLimit attribute. There is no default for this value; it simply acts as a child to the overall broker memory until the broker memory is exhausted.
minimumMessageSize 1024 for non-serialized messages (embedded broker) - the assumed size of the message used for memory usage calculation. Serialized messages used the serialized size as the basis for the memory calculation
cursorMemoryHighWaterMark 70% the tipping point at which a system memory limit will cause a cursor to block or spool to disk
storeUsageHighWaterMark 100% the tipping point at which a system usage store limit will cause a sent to block
prioritizedMessages false have the store respect message priority
advisoryForConsumed false send an advisory message when a message is consumed by a client
advisoryForDelivered false send an advisory message when a message is sent to a client
advisoryForDiscardedMessages false send an advisory when a message is discarded
advisoryForSlowConsumers false send an advisory message if a consumer is deemed slow
advsioryForFastProducers false send an advisory message if a producer is deemed fast
advisoryWhenFull false send an advisory message when a limit (memory,store,temp disk) is full
gcInactiveDestinations false delete inactive destination
inactiveTimoutBeforeGC 5000 inactivity period (in ms) before destination is considered inactive
slowConsumerStrategy null sets the strategy for handling slow consumers. see abortSlowConsumerStrategy

Additional properties for a Queue

property default description
useConsumerPriority true use the priority of a consumer when dispatching messages from a Queue
strictOrderDispatch false if true queue will not round robin consumers, but it'll use a single one until its prefetch buffer is full
optimizedDispatch false don't use a separate thread for dispatching from a Queue
lazyDispatch false only page in from store the number of messages that can be dispatched at time
consumersBeforeDispatchStarts 0 when the first consumer connects, wait for specified number of consumers before message dispatching starts
timeBeforeDispatchStarts 0 when the first consumer connects, wait for specified time (in ms) before message dispatching starts
queuePrefetch n/a sets the prefetch for consumers that are using the default value
expireMessagesPeriod 30000 the period (in ms) of checks for message expiry on queued messages, value of 0 disables

Additional properties for a Topic

property default description
topicPrefetch n/a sets the prefetch for topic consumers that are using the default value
durableTopicPrefetch n/a sets the prefetch for durable topic consumers that are using the default value
alwaysRetroactive false makes all subscribers retroactive negating the need to modify the clients to enable this feature
expireMessagesPeriod 30000 the period (in ms) of checks for message expiry on inactive durable subscribers, value of 0 disables

Note: items in red are available from version 5.6

The following are examples of different policies that can be customised on a per destination basis

Here is an example of this in use.

<beans 
  xmlns="http://www.springframework.org/schema/beans" 
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

  <broker persistent="false" brokerName="${brokername}" xmlns="http://activemq.apache.org/schema/core">

    <!--  lets define the dispatch policy -->
    <destinationPolicy>
      <policyMap>
        <policyEntries>
          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <roundRobinDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>

          <policyEntry topic="ORDERS.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <!--  1 minutes worth -->
            <subscriptionRecoveryPolicy>
              <timedSubscriptionRecoveryPolicy recoverDuration="60000" />
            </subscriptionRecoveryPolicy>
          </policyEntry>

          <policyEntry topic="PRICES.>">

            <!-- lets force old messages to be discarded for slow consumers -->
            <pendingMessageLimitStrategy>
              <constantPendingMessageLimitStrategy limit="10"/>
            </pendingMessageLimitStrategy>

            <!--  10 seconds worth -->
            <subscriptionRecoveryPolicy>
              <timedSubscriptionRecoveryPolicy recoverDuration="10000" />
            </subscriptionRecoveryPolicy>
            
          </policyEntry>
          <policyEntry tempTopic="true" advisoryForConsumed="true" />

          <policyEntry tempQueue="true" advisoryForConsumed="true" />
        </policyEntries>
      </policyMap>
    </destinationPolicy>
  </broker>

</beans>
© 2004-2011 The Apache Software Foundation.
Apache ActiveMQ, ActiveMQ, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram