blob: 9a10bcfc166bd66d0e5b79b6cdf14d0224fd5546 [file] [log] [blame]
<div class="wiki-content maincontent"><p>We support destination wildcards to provide easy support for federated name hierarchies. This concept has been popular in financial market data for some time as a way of organizing events (such as price changes) into hierarchies and to use wildcards for easy subscription of the range of information you're interested in.</p><p>For example imagine you are sending price messages from a stock exchange feed. You might use some kind of destination such as</p><ul><li><code>PRICE.STOCK.NASDAQ.ORCL</code> to publish Oracle Corporation's price on NASDAQ and</li><li><code>PRICE.STOCK.NYSE.IBM</code> to publish IBM's price on the New York Stock Exchange</li></ul><p>A subscriber could then use exact destinations to subscribe to exactly the prices it requires. Or it could use wildcards to define hierarchical pattern matches to the destinations to subscribe from.</p><h3 id="Wildcards-Wildcardssupported">Wildcards supported</h3><p>We support the following wildcards which are fairly standard practice; wildcards are not part of the JMS specification so are custom enhancements.</p><ul><li><code>.</code> is used to separate names in a path</li><li><code>*</code> is used to match any name in a path</li><li><code>&gt;</code> is used to recursively match any destination starting from this name</li></ul><p>For example using the example above, these subscriptions are possible</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Subscription</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Meaning</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>PRICE.&gt;</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Any price for any product on any exchange</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>PRICE.STOCK.&gt;</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Any price for a stock on any exchange</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>PRICE.STOCK.NASDAQ.*</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Any stock price on NASDAQ</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>PRICE.STOCK.*.IBM</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Any IBM stock price on any exchange</p></td></tr></tbody></table></div><p><strong>Note:</strong> Don't specify any string after '&gt;' on your wildcard expression, it will be ignored. E.g. using a wildcard <code>PRICE.&gt;.IBM</code> will also match <code>PRICE.STOCK.NASDAQ.FB.</code> Using '&gt;' really matches everything till the end of the destination name.</p><h3 id="Wildcards-Custompathseparator">Custom path separator</h3><p>As of version 5.5.0 we support <a shape="rect" class="external-link" href="http://activemq.apache.org/interceptors.html">plugin</a> that allows clients to use customer path separator. So instead of</p><p><code>FOO.BAR.*</code></p><p>you can use</p><p><code>FOO/BAR/*</code></p><p>To</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"> &lt;plugins&gt;
.....
&lt;destinationPathSeparatorPlugin/&gt;
&lt;/plugins&gt;
</pre>
</div></div><p>Please note that you should add this plugin as last if you want it to work properly with other plugins (such as <a shape="rect" class="external-link" href="http://activemq.apache.org/security.html">security</a> for example).</p><p>A default path separator this plugin will use is <code>/</code>. You can customize it further using <code>pathSeparator</code> property.</p></div>