Topic Configuration on Java Broker
New in 0.8 is the ability to define configuration for topics. Currently this is limited to
configuration for slow consumer detection. This configuration is based on the work
designed on the design
wiki.
Topic Identification
A configuration section has two entries that can be used to identify how the
configuration will be applied: 'name' and 'subscriptionName'.
<topic>
<name>stocks.us</name>
<topic>
<subscriptionName>clientid:mysubscription</subscriptionName>
It is also possible to combine these two identifiers to specify a unique subscription to
a given topic.
<topic>
<name>stocks.us</name>
<subscriptionName>clientid:mysubscription</subscriptionName>
Configuration Items
Currently only one element of the designed configuration is processed, that of the
slow consumer detection. This is setup as below using the 'slow-consumer-detection'
element. There are two required types of tag, first the trigger, which is one of
'depth', 'messageAge' or 'messageCount' and secondly the 'policy'.
<slow-consumer-detection>
<!-- The maximum depth before which the policy will be applied-->
<depth>4235264</depth>
<!-- The maximum message age before which the policy will be applied-->
<messageAge>600000</messageAge>
<!-- The maximum number of message before which the policy will be applied-->
<messageCount>50</messageCount>
<!-- Policy Selection -->
<policy name="TopicDelete"/>
</slow-consumer-detection>
The trigger is used to determine when the policy should be applied. Currently we have
a simple policy 'topicdelete', this will disconnect consumers of topics where their
consumption rate falls sufficiently to hit one of the trigger values.
Limitiations
As of 0.8 the topic configuration is limited to straight string matching. This means
that given the following two topic configuring sections for 'stocks.us' and 'stocks.*' a
subscription for 'stocks.uk' will not match the expected 'stocks.*'. Nor will any
additional configuration listed in 'stocks.*' affect any 'stocks.us' subscriptions.
<topics>
<topic>
<name>stocks.us</name>
...
</topic>
<topic>
<name>stocks.*</name>
...
</topic>
</topics>
A subscription for 'stocks.us' will only receive configuration settings that are
defined in the 'stocks.us' section.