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:

Common Property

Default Value

Description

advisoryForConsumed

false

Send an advisory message when a message is consumed by a client.

advisoryForDelivery

false

Send an advisory message when a message is sent to a client.

advisoryForFastProducers

false

Send an advisory message if a producer is deemed fast.

advisoryForSlowConsumers

false

Send an advisory message if a consumer is deemed slow.

advisoryWhenFull

false

Send an advisory message when a limit (memory, store, temp disk) is full.

cursorMemoryHighWaterMark

70

The percentage (%) threshold applied either to the <systemUsage>/<memoryUsage> or the destination's memoryLimit (when defined) which when exceeded will cause the destination's cursor to either block or write to disk.

enableAudit

true

When true the broker will track duplicate messages. Duplicates can happen for non-persistent messages during failover.

gcInactiveDestinations

false

Garbage collect inactive destinations.

inactiveTimoutBeforeGC

5000

The timeout (in ms) after which a destination is considered inactive.

includeBodyForAdvisory

false

Includes the body of the original message that triggered the advisory as part of the dataStructure field in the advisory message (where applicable). Normally the message body is cleared.

maxBrowsePageSize

400

The maximum number of messages to page in from the store at one time for a browser.

maxDestinations

-1

(v5.12) If 0 or greater, sets the maximum number of destinations that can be created. This parameter is intended to limit the number of hierarchical destinations that can be created under a wildcard destination.

maxPageSize

200

The maximum number of messages to page in from the store at one time. Increase this value to improve performance for queue destination's that contain grouped messages that are consumed by multiple concurrent consumers.

memoryLimit

n/a

The memory limit (in bytes) of the destination's cursor.

This memory limit is subordinate to the system level memory limit, as specified by the <systemUsage>/<memoryUsage> 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.

Note: when this limit is specified the destination's cursorMemoryHighWaterMark will be applied against it and not the <systemUsage>/><memoryUsage> memory limit.

minimumMessageSize

1024

For non-serialized messages (embedded broker) - the assumed size of the message used for memory usage calculation. Serialized messages use the serialized size as the basis for the memory calculation.

prioritizedMessages

false

Persist message priority information.

producerFlowControl

true

If true the broker will throttle (flow-control) the producer. Throttling is achieved either by withholding the producer's ACK or by raising a javax.jms.ResourceAllocationException (that's propagated back to the client) when local resources e.g., memory and/or storage, have been exhausted.

If false excess messages will be written to the message store to prevent memory exhaustion. However, when the message store reaches capacity the producer will be throttled until resources are freed.

slowConsumerStrategy

null

Sets the strategy for handling slow consumers. See AbortSlowConsumerStrategy.

storeUsageHighWaterMark

100

The percentage (%) threshold of the <systemUsage>/<storeUsage> store limit which when exceeded causes a send to block.

useCache

true

If true persistent messages are cached for fast retrieval from store.

usePrefetchExtension

true

The prefetch extension is used when a message is delivered but not ACK'ed, such that the broker can dispatch another message, e.g., prefetch == 0, the idea being that there will always be prefetch number of messages pending. It also allows a transaction batch to exceed the prefetch value.

Additional properties for a Queue

Queue Only Property

Default Value

Description

consumersBeforeDispatchStarts

0

When the first consumer connects, wait for specified number of consumers before message dispatching starts.

expireMessagesPeriod

30000

The period (in ms) of checks for message expiry on queued messages, value of 0 disables.

lazyDispatch

false

Only page in from store the number of messages that can be dispatched at time.

optimizedDispatch

false

Don't use a separate thread for dispatching from a Queue.

persistJMSRedelivered

false

(v 5.10) If true, before a persistent message is dispatched by the broker for the first time, the message is rewritten to reflect the possible delivery.

This ensures the message JMSRedelivered header is a reliable indication of possible duplicate delivery.

queuePrefetch

n/a

Sets the prefetch for consumers that are using the default value.

strictOrderDispatch

false

If true queue will not round robin consumers, but it'll use a single one until its prefetch buffer is full.

timeBeforeDispatchStarts

0

When the first consumer connects, wait for specified time (in ms) before message dispatching starts.

useConsumerPriority

true

Use the priority of a consumer when dispatching messages from a Queue.

Additional properties for a Topic

Topic Only Property

Default Value

Description

advisoryForDiscardingMessages

false

Send an advisory when a message is discarded from a non durable subscription.

alwaysRetroactive

false

Makes all subscribers retroactive negating the need to modify the clients to enable this feature.

durableTopicPrefetch

n/a

Sets the prefetch for durable topic consumers that are using the default value.

expireMessagesPeriod

30000

The interval (in ms) between message expiration checks on inactive durable subscribers.

Note: set to 0 to disable message expiration checking.

topicPrefetch

n/a

Sets the prefetch for topic consumers that are using the default value.

The following are examples of different policies that can be customized 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 minute's 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