2014-10-31 06:20:28 -04:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<!-- ============================================================================= -->
|
|
|
|
|
<!-- Copyright © 2009 Red Hat, Inc. and others. -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- The text of and illustrations in this document are licensed by Red Hat under -->
|
|
|
|
|
<!-- a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- An explanation of CC-BY-SA is available at -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- http://creativecommons.org/licenses/by-sa/3.0/. -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- In accordance with CC-BY-SA, if you distribute this document or an adaptation -->
|
|
|
|
|
<!-- of it, you must provide the URL for the original version. -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- Red Hat, as the licensor of this document, waives the right to enforce, -->
|
|
|
|
|
<!-- and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent -->
|
|
|
|
|
<!-- permitted by applicable law. -->
|
|
|
|
|
<!-- ============================================================================= -->
|
|
|
|
|
<chapter id="jms-core-mapping">
|
|
|
|
|
<title>JMS与内核API之间的映射关系</title>
|
2014-11-19 03:44:57 -05:00
|
|
|
|
<para>本意讲述JMS的目标实体(destination)如何映射到ActiveMQ的地址(addresses)。</para>
|
|
|
|
|
<para>ActiveMQ的内核没有JMS的任何实现。在内核中没有topic的概念,它是通过在一个地址上(相当于topic的名字)绑定
|
2014-10-31 06:20:28 -04:00
|
|
|
|
零或多个queue来实现JMS topic的功能的。每个绑定的queue相当于该topic的一个订阅(subscription)。
|
|
|
|
|
类似地通过在一个地址上(相当于queue的名字)绑定单一的queue就可以实现JMS queue的功能。</para>
|
|
|
|
|
<para>按照惯例,所有的JMS queue所对应的内核queue的名字都以<literal>jms.queue.</literal>做为开头。比如
|
|
|
|
|
当JMS queue的名字是"orders.europe"时,其对应的内核queue的名字应该是"jms.queue.orders.europe"。
|
|
|
|
|
那么内核queue所绑定的地址的名字和该内核queue的名字是相同的。</para>
|
|
|
|
|
<para>同样,所有JMS topic所对应的内核地址的名字都以 "jms.topic."为前缀。比如当一个JMS topic的名字是"news.europe"
|
|
|
|
|
时,它对应的内核的地址应该是"jms.topic.news.europe"。</para>
|
|
|
|
|
<para>换句话说就是如果你向JMS queue “orders.europe"发送一个消息,这个消息就会被路由到绑定在内核地址为“jms.queue.orders.europe”
|
|
|
|
|
的同名内核queue中。 如果是向JMS topic “news.europe“发送一个消息,它会被路由到绑定到内核地址为
|
|
|
|
|
”jms.topic.news.europe“的所有的内核queue中。</para>
|
|
|
|
|
<para>具体要配置一个名为“orders.europe"的JMS队列时,你需要配置相应的内核queue“jms.queue.orders.europe“:</para>
|
|
|
|
|
<programlisting>
|
|
|
|
|
<!-- expired messages in JMS Queue "orders.europe"
|
|
|
|
|
will be sent to the JMS Queue "expiry.europe" -->
|
|
|
|
|
<address-setting match="jms.queue.orders.europe">
|
|
|
|
|
<expiry-address>jms.queue.expiry.europe</expiry-address>
|
|
|
|
|
...
|
|
|
|
|
</address-setting>
|
|
|
|
|
</programlisting>
|
|
|
|
|
</chapter>
|