blob: dc5be096077e0251af2b7bfa929f65459c3760e9 [file] [log] [blame]
<div class="wiki-content maincontent">
<p>As of version 1.1, ActiveMQ supports a technology we call <em>composite destinations</em>. This allows a single virtual JMS Destination to be used to represent a collection of JMS Destinations.</p>
<p>For example you can use composite destinations to send a message to 12 physical queues in one operation. Or send a message to one topic and one queue in one operation.</p>
<p>We do this using a simple separator of "," allowing a number of destinations to be specified when creating a destintation, or registering destinations in JNDI. e.g. the destination</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;">
FOO.A,FOO.B,FOO.C
</pre>
</div></div>
<p>Represents 3 different destinations. This could be used with a queue or topic to represent a set of 3 destinations. e.g.</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;">
// send to 3 queues as one logical operation
Queue queue = new ActiveMQQueue("FOO.A,FOO.B,FOO.C");
producer.send(queue, someMessage);
</pre>
</div></div>
<p>If you wish to mix and match the types of destination, you can use a prefix of <strong>queue://</strong> or <strong>topic://</strong> to differentiate the type of destination. e.g. to publish on a queue but also make a notification on a topic as well you could use</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;">
// send to queues and topic one logical operation
Queue queue = new ActiveMQQueue("FOO.A,topic://NOTIFY.FOO.A");
producer.send(queue, someMessage);
</pre>
</div></div>
<p>Composite destinations can also be configured on the <a shape="rect" href="virtual-destinations.html">broker side</a>, such that messages sent to a single destination by the client will be transparently copied to multiple physical destinations.</p></div>