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:

propertydefaultdescription
producerFlowControltruethe 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
enableAudittruetracks duplicate messages (which can occur in failover for non-persistent messages)
useCachetruepersistent messages are cached for fast retrieval from store
maxPageSize200maximum number of persistent messages to page from store at a time
maxBrowsePageSize400maximum number of persistent messages to page from store for a browser
memoryLimitn/aThe 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.
minimumMessageSize1024for 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
cursorMemoryHighWaterMark70%the tipping point at which a system memory limit will cause a cursor to block or spool to disk
storeUsageHighWaterMark100%the tipping point at which a system usage store limit will cause a sent to block
prioritizedMessagesfalsehave the store respect message priority
advisoryForConsumedfalsesend an advisory message when a message is consumed by a client
advisoryForDeliveredfalsesend an advisory message when a message is sent to a client
advisoryForSlowConsumersfalsesend an advisory message if a consumer is deemed slow
advsioryForFastProducersfalsesend an advisory message if a producer is deemed fast
advisoryWhenFullfalsesend an advisory message when a limit (memory,store,temp disk) is full
gcInactiveDestinationsfalsedelete inactive destination
inactiveTimoutBeforeGC5000inactivity period (in ms) before destination is considered inactive
slowConsumerStrategynullsets the strategy for handling slow consumers. see abortSlowConsumerStrategy

Additional properties for a Queue

propertydefaultdescription
useConsumerPrioritytrueuse the priority of a consumer when dispatching messages from a Queue
strictOrderDispatchfalseif true queue will not round robin consumers, but it'll use a single one until its prefetch buffer is full
optimizedDispatchfalsedon't use a separate thread for dispatching from a Queue
lazyDispatchfalseonly page in from store the number of messages that can be dispatched at time
consumersBeforeDispatchStarts0when the first consumer connects, wait for specified number of consumers before message dispatching starts
timeBeforeDispatchStarts0when the first consumer connects, wait for specified time (in ms) before message dispatching starts
queuePrefetchn/asets the prefetch for consumers that are using the default value
expireMessagesPeriod30000the period (in ms) of checks for message expiry on queued messages, value of 0 disables

Additional properties for a Topic

propertydefaultdescription
topicPrefetchn/asets the prefetch for topic consumers that are using the default value
durableTopicPrefetchn/asets the prefetch for durable topic consumers that are using the default value
advisoryForDiscardingMessages falsesend an advisory when a message is discarded from a non durable subscription
alwaysRetroactivefalsemakes all subscribers retroactive negating the need to modify the clients to enable this feature
expireMessagesPeriod30000the 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