activemq-artemis/docs/user-manual/zh/jms-core-mapping.xml

43 lines
3.5 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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 AttributionShare 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>
<para>本意讲述JMS的目标实体destination如何映射到HornetQ的地址addresses</para>
<para>HornetQ的内核没有JMS的任何实现。在内核中没有topic的概念它是通过在一个地址上相当于topic的名字绑定
零或多个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>
&lt;!-- expired messages in JMS Queue "orders.europe"
will be sent to the JMS Queue "expiry.europe" --&gt;
&lt;address-setting match="jms.queue.orders.europe"&gt;
&lt;expiry-address&gt;jms.queue.expiry.europe&lt;/expiry-address&gt;
...
&lt;/address-setting&gt;
</programlisting>
</chapter>