Skip to main content
Skip table of contents

Subscribing to Node(s) in Topic Hierarchy

Subscriptions are created as defined by JMS using TopicSessions. The normal createSubscriber APIs, provided by JMS, can be used to create subscriptions on hierarchical topics.
A subscriber can subscribe to multiple topics using a wild-card character. Subscribing to a topic containing a valid wild-card character effectively creates subscribers on all the topics in the hierarchy that match that expression.

Template Characters Used in Subscription

Wild-card characters are special characters used in the creation of topic hierarchies. In the topics hierarchy, these characters are referred to as Template Characters. The period (.) delimiter is used together with the asterisk (star) and the pound (#) template characters to fulfill subscriptions. Using these characters avoids having to subscribe to multiple topics on the server. Client applications can use template characters when subscribing to a set of topics or while binding a set of topics.
There are two FioranoMQ template characters used in subscription-creation; the asterisk (star) and the pound (#):

  • Asterisk (star): FioranoMQ uses two types of conventions for this template character An asterisk (star) must be the last template character in subscription expression. Subscriptions are made for the root node and all matching subordinate nodes in the hierarchy.

For Example: If the expression for subscription is ABC.*, then ABC and all its subordinate topics will be matched.
An asterisk (star) is the intermediate character within a subscription expression. Where a root topic is not selected an (star) is taken as "one or more occurrence of a character ". Example: If the topic for subscription is ABC.*.1 then ABC will not be selected but all topics that match this pattern will be selected and used to subscription. Example: ABC.1.1, ABC.1.1.1, and ABC.2.1.

  • Pound (#): The pound (#) selects all topics one level down the hierarchy. If the (#) character is present in the pattern, then all the topics one level down the hierarchy are used for subscription. Example: If the subscription topic name is ABC.# then all the topics a level below ABC will be matched. Example: ABC.1, ABC.2 will match ABC.#, but ABC.1.1 and ABC.1.2 do not match the pattern and will not be used.
  • Template characters exist to allow a set of managed topics to exist in a message server. This, in turn, allows the subscriber to choose broad subscription parameters that include preferred topics and avoid irrelevant topics.

The constraints in using template characters are
At node level, a template character precludes using other template characters. Example: Qualifying the selection against the pattern A.B*.1 is not allowed where as A.B.*.1 is allowed. In the patterns used, each character must be separated with a delimiter (.).
Template characters used as replacement are not allowed.
Other than the wild-card characters (star), (#), (.), no other wild-card character is used for subscription to multiple topics.
Conventions used in Hierarchical topics: Only two template characters are used in Fiorano hierarchical topics. These characters are the pound (#) and the asterisk (star) with a delimiter (.).
Using the asterisk (star)
Subscription Expression ABC.*
Convention used: If (star) is the last character in a subscription expression with no other template character used, then the root topic and all other topics (where (star) is replaced with one or more occurrences of any character) will be selected for subscription on Hierarchical topics.
Example:
If the following Topics exist on the MQ Server: ABC, ABC.1, ABC.2, ABC.1.1, and ABC.1.2
And the expression used for subscription is:
ABC.*
Then the matched topics are:
ABC, ABC.1, ABC.2, ABC.1.1, ABC.1.2
Subscription topic name format:
ABC.*.1
Convention used: If (star) is the intermediate character in a subscription expression then all other topics (where * is replaced with one or more occurrences of any character in name) will be selected for that subscription. The root topic is not included in such a selection.
Example:
The the Topics existing in MQ Server are:
ABC, ABC.1, ABC.2, ABC.1.1, and ABC.1.1.1
And the expression used for subscription is:
ABC.*.1
Then the Matched topics are:
ABC.1.1, ABC.1.1.1
Using the pound (#) character
Subscription topic name format:
ABC. #
Convention used: If (#) is the only wild-character present in the expression then all topics (where (#) is replaced with only one occurrence of any character in name) would be used for subscription.
Example
If the Topics existing on the MQ Server are:
ABC, ABC.1, ABC.2, ABC.1.1, ABC.1.1.1
And the expression used for subscription is:
ABC. #
Then the Matched topics are:
ABC.1, ABC.2
If the Subscription topic name is ABC#.1,
Then the Matched topics are:
ABC.1.1, ABC.2.1, ABC.3.1
Using a combination of template characters: Both template characters can be used in a subscription expression, as explained below.
Subscription topic name format:
ABC.*.#
Convention used: The above topic name is invalid. The pound (#) character after the asterisk (star) character has no function in an expression.
Subscription topic name format:
ABC.#.*
Convention used: In this expression all the topics (where (#) is replaced with one occurrence of a character and (star) is replaced with one or more occurrence of a character) will be used for subscription.
Example:
If the Topics existing on the MQ Server are:
ABC, ABC.1, ABC.1.1, ABC.2, ABC.2.1
And the subscription expression is:
ABC.#.*,
Then the Matched topics are:
ABC.1.1, ABC.2.1

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.