http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/docs/user-manual/src/main/resources/schemaToTable.xsl ---------------------------------------------------------------------- diff --git a/docs/user-manual/src/main/resources/schemaToTable.xsl b/docs/user-manual/src/main/resources/schemaToTable.xsl new file mode 100644 index 0000000..1f5deda --- /dev/null +++ b/docs/user-manual/src/main/resources/schemaToTable.xsl @@ -0,0 +1,374 @@ +<?xml version="1.0" encoding="iso-8859-1"?> + +<xsl:stylesheet version="2.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:hq="urn:org.hornetq" + xmlns:fn="http://www.w3.org/2005/xpath-functions"> + + <!-- + XSL to transform HornetQ schemas into DocBook tables to be used in our user manual reference. + + For each option element defined in the schema, it tries to create something like + + <row> + <entry> + <link linkend="DocBookIdReference">ELEMENT-NAME</link> + </entry> + <entry>TYPE</entry> + <entry>DESCRIPTION</entry> + <entry>DEFAULT_VALUE</entry> + </row> + + TODO: + - generate Java code with the defaults (instead of duplicating them there). + --> + + <xsl:output method="xml" indent="yes"/> + + <xsl:function name="hq:name-or-ref"> + <xsl:param name="ename"/> + <xsl:param name="eref"/> + <xsl:choose> + <xsl:when test="string-length($ename) > 0 "> + <xsl:value-of select="$ename"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$eref"/> + </xsl:otherwise> + </xsl:choose> + </xsl:function> + + <xsl:template match="/"> + <tbody> + + <xsl:comment> + THIS IS A GENERATED FILE. DO NOT EDIT IT DIRECTLY! + + HornetQ options reference table generated from: + <xsl:copy-of select="concat('hornetq-', substring-after(base-uri(), 'hornetq-'))"/> + + ======================================================================= + + XSLT Version = <xsl:copy-of select="system-property('xsl:version')"/> + XSLT Vendor = <xsl:copy-of select="system-property('xsl:vendor')"/> + XSLT Vendor URL = <xsl:copy-of select="system-property('xsl:vendor-url')"/> + <xsl:text>
</xsl:text> + </xsl:comment> + + <!-- Add some new lines of text.. --> + <xsl:text>
</xsl:text> + <xsl:text>
</xsl:text> + + <!-- main 'for-each' for "hornetq-configuration.xsd". Notice the attribute matching at the + select which ensures this only matches "hornetq-configuration.xsd". --> + <xsl:for-each-group select="xsd:schema/xsd:element[@hq:schema='hornetq-configuration']" + group-by="@name"> + <!-- the manual reference should list options in sorted order. + Notice that this is only OK because the first level of options is "xsd:all". + + Options of sub-types are not ordered because they are often "xsd:sequence" (meaning that + their order matters), so those options should not have its order changed. + --> + <xsl:sort select="@name" data-type="text" /> + + <!-- <xsl:if test="not(./xsd:annotation/@hq:linkend)"> --> + <!-- <xsl:message terminate="yes"> --> + <!-- Error: Lacks proper Docbook link: xsd:annotation/@hq:linkend --> + <!-- <xsl:copy-of select="."/> --> + <!-- </xsl:message> --> + <!-- </xsl:if> --> + <xsl:call-template name="xsd_element"> + <xsl:with-param name="prefix"/> + <xsl:with-param name="parentLinkend" select="xsd:annotation/@hq:linkend"/> + </xsl:call-template> + + <!-- Add 2 new lines between each option --> + <xsl:text>
</xsl:text> + <xsl:text>
</xsl:text> + </xsl:for-each-group> + + <!-- JMS: main 'for-each' for "hornetq-jms.xsd". Notice the attribute matching at the + select which ensures this only matches "hornetq-jms.xsd". --> + <xsl:for-each select="xsd:schema/xsd:element[@hq:schema='hornetq-jms-configuration']/xsd:complexType/xsd:sequence/xsd:element"> + + <xsl:call-template name="xsd_element"> + <xsl:with-param name="prefix"/> + <xsl:with-param name="parentLinkend" select="xsd:annotation/@hq:linkend"/> + </xsl:call-template> + + <!-- Add 2 new lines between each option --> + <xsl:text>
</xsl:text> + <xsl:text>
</xsl:text> + </xsl:for-each> + + </tbody> + </xsl:template> + + <xsl:template name="xsd_complexType" match="xsd:complexType"> + <xsl:param name="prefix" /> + <xsl:param name="linkend" /> + + <xsl:comment> + 
VALUE OF COMPLEX TYPE
 + </xsl:comment> + + <xsl:apply-templates select="xsd:attribute"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="parentLinkend" select="$linkend"/> + </xsl:apply-templates> + + <xsl:for-each select="(xsd:sequence|xsd:all)/xsd:element"> + <xsl:call-template name="xsd_element"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="parentLinkend" select="$linkend"/> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + + <xsl:template name="entry-for-default-value"> + <entry> + <xsl:value-of select="string-join((@default,xsd:annotation/@hq:default), ' ')"/> + </entry> + </xsl:template> + + <xsl:template name="entry-for-description"> + <entry> + <xsl:value-of select="normalize-space(xsd:annotation/xsd:documentation)"/> + </entry> + </xsl:template> + + <xsl:template name="entry-for-simple-type"> + <entry> + <xsl:value-of select="@type"/> + </entry> + </xsl:template> + + <xsl:template name="entry-type-of-complex-element"> + <entry> + <xsl:choose> + <xsl:when test="count(xsd:complexType/xsd:sequence/xsd:element)=1"> + <xsl:value-of + select="concat('Sequence of <', xsd:complexType/xsd:sequence/xsd:element/( hq:name-or-ref(@name,@ref) ), '/>')"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>Complex element</xsl:text> + </xsl:otherwise> + </xsl:choose> + </entry> + </xsl:template> + + <xsl:template match="xsd:attribute"> + <xsl:param name="prefix" /> + <xsl:param name="parentLinkend" /> + + <xsl:variable name="linkend"> + <xsl:choose> + <xsl:when test="xsd:annotation/@hq:linkend"> + <xsl:value-of select="xsd:annotation/@hq:linkend"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$parentLinkend"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <row> + <entry> + <xsl:element name="link"> + <xsl:attribute name="linkend"> + <xsl:value-of select="$linkend"/> + </xsl:attribute> + <xsl:value-of select="$prefix"/> + <xsl:value-of select="@name"/> + <xsl:text> (</xsl:text> + <xsl:if test="@use = 'required'"> + <xsl:text>required </xsl:text> + </xsl:if> + <xsl:text>attribute)</xsl:text> + </xsl:element> + </entry> + <xsl:call-template name="entry-for-simple-type"/> + <xsl:call-template name="entry-for-description"/> + <xsl:call-template name="entry-for-default-value"/> + </row> + </xsl:template> + + + <!-- ELEMENT --> + <xsl:template name="xsd_element"> + <xsl:param name="prefix" /> + <xsl:param name="parentLinkend" /> + + <xsl:comment>
ELEMENT TEMPLATE name=<xsl:value-of select="@name"/> + <xsl:text>
</xsl:text> + </xsl:comment> + + <xsl:text>
</xsl:text> + <!-- + + We handle the following situations (differently): + 1. <element name="foo" /> find definition using 'name' + 2. <element name="foo>....</element>: complexType,simpleType,etc + 3. <element name="foo" type="xsd:BUILTIN"/> 'simple' simpleType + 4. <element name="foo" type="fooType"/> find definition using 'type' + 5. <element ref="foo"> find definition using 'ref' + + --> + + <xsl:variable name="linkend"> + <xsl:choose> + <xsl:when test="xsd:annotation/@hq:linkend"> + <xsl:value-of select="xsd:annotation/@hq:linkend"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$parentLinkend"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:choose> + + <xsl:when test="@name"> + <!-- cases 1,2,3,4 --> + + <xsl:choose> + <!-- XSD:BUILT-IN --> + <xsl:when test="starts-with(string(@type), 'xsd:')"> + <row> + <xsl:call-template name="entry-for-name"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="linkend" select="$linkend"/> + </xsl:call-template> + <xsl:call-template name="entry-for-simple-type"/> + <xsl:call-template name="entry-for-description"/> + <xsl:call-template name="entry-for-default-value"/> + </row> + </xsl:when> + + <xsl:when test="not(@type)"> + <xsl:choose> + <xsl:when test="xsd:complexType"> + <row> + <xsl:call-template name="entry-for-name"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="linkend" select="$linkend"/> + </xsl:call-template> + <xsl:call-template name="entry-type-of-complex-element"/> + <xsl:call-template name="entry-for-description"/> + <entry/> <!-- complexTypes have no 'default' value. --> + </row> + + <!-- backup-servers is a recursive type, which I need to take it out otherwise + there would be an infinite recursive loop --> + <xsl:if test="fn:not(@name='backup-servers')"> + <!-- Process child nodes --> + <xsl:apply-templates select="xsd:complexType"> + <xsl:with-param name="prefix" select="concat($prefix,@name,'.')"/> + <xsl:with-param name="linkend" select="$linkend"/> + </xsl:apply-templates> + </xsl:if> + </xsl:when> + + <!-- simpleType. Normally string restrictions: A|B|C --> + <xsl:when test="xsd:simpleType"> + <row> + <xsl:call-template name="entry-for-name"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="linkend" select="$linkend"/> + </xsl:call-template> + <entry> + <xsl:if test="xsd:simpleType/xsd:restriction[@base='xsd:string']"> + <xsl:value-of select="fn:string-join(xsd:simpleType/xsd:restriction/xsd:enumeration/@value,'|')"/> + </xsl:if> + </entry> + <xsl:call-template name="entry-for-description"/> + <xsl:call-template name="entry-for-default-value"/> + </row> + </xsl:when> + + <xsl:otherwise> + <!-- the NAME is a reference --> + <xsl:comment>
E.NAME-ref name=<xsl:copy-of select="@name"/><xsl:text>
</xsl:text></xsl:comment> + <xsl:variable name="my-type" select="@name"/> + <row> + <xsl:call-template name="entry-for-name"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="linkend" select="$linkend"/> + </xsl:call-template> + <xsl:call-template name="entry-type-of-complex-element"/> + <entry> + <xsl:value-of select="normalize-space(xsd:annotation/xsd:documentation)"/> + <xsl:value-of select="normalize-space(/xsd:schema/xsd:complexType[@name=$my-type]/xsd:annotation/xsd:documentation)"/> + </entry> + <entry/> <!-- no default value --> + </row> + <xsl:apply-templates select="/xsd:schema/xsd:complexType[@name=$my-type]"> + <xsl:with-param name="prefix" select="concat($prefix,@name,'.')"/> + <xsl:with-param name="linkend" select="$linkend"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + + <xsl:otherwise> + <!-- the TYPE is a reference --> + <!-- There is a type but it is not built-in, so we need to find its definition --> + <xsl:variable name="my-type" select="@type"/> + <row> + <xsl:call-template name="entry-for-name"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="linkend" select="$linkend"/> + </xsl:call-template> + <xsl:call-template name="entry-type-of-complex-element"/> + <entry> + <xsl:value-of select="normalize-space(xsd:annotation/xsd:documentation)"/> + <xsl:value-of select="normalize-space(/xsd:schema/xsd:complexType[@name=$my-type]/xsd:annotation/xsd:documentation)"/> + </entry> + <entry/> <!-- no default value --> + </row> + <xsl:comment>
ELEMENT TYPE-ref TEMPLATE CHILDREN
</xsl:comment> + <xsl:text>
</xsl:text> + <xsl:apply-templates select="/xsd:schema/xsd:complexType[@name=$my-type]"> + <xsl:with-param name="prefix" select="concat($prefix,@name,'.')"/> + <xsl:with-param name="linkend" select="$linkend"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + + </xsl:when> + + <xsl:when test="@ref"> + <xsl:comment>
ELEMENT REF TEMPLATE ref=<xsl:copy-of select="@ref"/>
</xsl:comment> + <xsl:text>
</xsl:text> + + <xsl:variable name="my-ref" select="@ref"/> + <xsl:for-each select="/xsd:schema/xsd:element[ @name = string($my-ref) ]"> + <xsl:call-template name="xsd_element"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="parentLinkend" select="$linkend"/> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <!-- FAIL? --> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="entry-for-name"> + <xsl:param name="prefix" /> + <xsl:param name="linkend" /> + + <entry> + <xsl:element name="link"> + <xsl:attribute name="linkend"> + <xsl:value-of select="$linkend"/> + </xsl:attribute> + <xsl:value-of select="$prefix"/> + <xsl:value-of select="@name"/> + </xsl:element> + </entry> + </xsl:template> + +</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/docs/user-manual/user-manual.xpr ---------------------------------------------------------------------- diff --git a/docs/user-manual/user-manual.xpr b/docs/user-manual/user-manual.xpr new file mode 100644 index 0000000..2f3e5dd --- /dev/null +++ b/docs/user-manual/user-manual.xpr @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <meta> + <filters directoryPatterns="" filePatterns="" + positiveFilePatterns="" showHiddenFiles="false"/> + <options/> + </meta> + <projectTree name="user-manual.xpr"> + <folder name="en"> + <folder name="diagrams"> + <file name="en/diagrams/architecture-diagrams.odg"/> + </folder> + <folder name="images"> + <file name="en/images/architecture1.jpg"/> + </folder> + <file name="en/appserver-integration.xml"/> + <file name="en/architecture.xml"/> + <file name="en/client-classpath.xml"/> + <file name="en/client-reconnection.xml"/> + <file name="en/clusters.xml"/> + <file name="en/configuration-index.xml"/> + <file name="en/configuring-transports.xml"/> + <file name="en/connection-ttl.xml"/> + <file name="en/core-bridges.xml"/> + <file name="en/diverts.xml"/> + <file name="en/duplicate-detection.xml"/> + <file name="en/embedding-hornetq.xml"/> + <file name="en/examples.xml"/> + <file name="en/filter-expressions.xml"/> + <file name="en/flow-control.xml"/> + <file name="en/ha.xml"/> + <file name="en/intercepting-operations.xml"/> + <file name="en/interoperability.xml"/> + <file name="en/jms-bridge.xml"/> + <file name="en/jms-core-mapping.xml"/> + <file name="en/large-messages.xml"/> + <file name="en/last-value-queues.xml"/> + <file name="en/libaio.xml"/> + <file name="en/logging.xml"/> + <file name="en/management.xml"/> + <file name="en/master.xml"/> + <file name="en/message-expiry.xml"/> + <file name="en/message-grouping.xml"/> + <file name="en/messaging-concepts.xml"/> + <file name="en/notice.xml"/> + <file name="en/paging.xml"/> + <file name="en/perf-tuning.xml"/> + <file name="en/persistence.xml"/> + <file name="en/pre-acknowledge.xml"/> + <file name="en/preface.xml"/> + <file name="en/project-info.xml"/> + <file name="en/queue-attributes.xml"/> + <file name="en/scheduled-messages.xml"/> + <file name="en/security.xml"/> + <file name="en/send-guarantees.xml"/> + <file name="en/thread-pooling.xml"/> + <file name="en/transaction-config.xml"/> + <file name="en/undelivered-messages.xml"/> + <file name="en/using-core.xml"/> + <file name="en/using-jms.xml"/> + <file name="en/using-server.xml"/> + <file name="en/wildcard-routing.xml"/> + <file name="en/wildcard-syntax.xml"/> + </folder> + </projectTree> +</project> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/docs/user-manual/zh/appserver-integration.xml ---------------------------------------------------------------------- diff --git a/docs/user-manual/zh/appserver-integration.xml b/docs/user-manual/zh/appserver-integration.xml new file mode 100644 index 0000000..a77e810 --- /dev/null +++ b/docs/user-manual/zh/appserver-integration.xml @@ -0,0 +1,1001 @@ +<?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="appserver-integration"> + <title>Java EEååºç¨æå¡å¨çéæ</title> + <para>HornetQå¯ä»¥å®¹æå°å®è£ å°JBoss 4åºç¨æå¡å¨åå ¶ä»¥ä¸çæ¬ãæå ³å®è£ ç详ç»è¯´æ请åé å¿«éæåã</para> + <para>HornetQæä¾äºä¸ä¸ªJCAéé å¨ï¼ä½¿å¾å®è¿å¯ä»¥ä¸å ¶å®JEEå ¼å®¹çåºç¨æå¡å¨éæã请åé å ¶å®åºç¨æå¡å¨ç + æå ³JCAéé å¨éæç说ææ¥æä½ã</para> + <para>JCAéé å¨çä½ç¨æ¯æ§å¶æ¶æ¯æµå ¥å°æ¶æ¯Beanï¼MDBï¼ï¼å¹¶æ§å¶æ¶æ¯ä»åç§JEE模åä¸ååºï¼å¦EJBåServletï¼ã</para> + <para>æ¬ç« 讲述è¿äºJEE模åé ç½®HornetQçåºæ¬ä¿¡æ¯ã</para> + <section> + <title>é ç½®æ¶æ¯Bean</title> + <para>使ç¨HornetQåMDBä¼ éæ¶æ¯ï¼éè¦å¨æ件<literal>ra.xml</literal>ä¸é ç½®JCAéé å¨ã该æä»¶å¨ + <literal>jms-ra.rar</literal>æ件ä¸ãé»è®¤é ç½®ä¸HornetQæå¡ä½¿ç¨InVmè¿æ¥å¨æ¥æ¶æ¶æ¯ãå¨æ¬ç« + åé¢ååºäºå¯é ç½®çé项ã</para> + <para>ææMDBé½éè¦æç®æ ç±»ååç®æ çç¸å ³é ç½®ãä¸é¢å°±æ¯ä¸ä¸ªä½¿ç¨annotationé ç½®MDBçä¾åï¼</para> + <programlisting>@MessageDriven(name = "MDBExample", + activationConfig = + { + @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), + @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue") + }) +@ResourceAdapter("hornetq-ra.rar") +public class MDBExample implements MessageListener +{ + public void onMessage(Message message)... +}</programlisting> + <para>ä¸ä¾ä¸é ç½®äºMDBä»ä¸ä¸ªéåä¸æ¥æ¶æ¶æ¯ï¼å®çJNDIç»å®å为<literal>queue/testQueue</literal>ã + è¿ä¸ªéåå¿ é¡»äºå å¨HornetQæå¡å¨é ç½®æ件ä¸é 置并é¨ç½²å¥½çã</para> + <para><literal>ResourceAdapter</literal> annotationç¨æ¥æåºä½¿ç¨åªä¸ªéé å¨ãè¦ä½¿ç¨å®å¿ é¡»è¦å¼å ¥ + <literal>org.jboss.ejb3.annotation.ResourceAdapter</literal> ï¼JBoss AS 5.xæ以ä¸ï¼ã + è¿ä¸ªç±»å¨ + <literal>jboss-ejb3-ext-api.jar</literal>æ件ä¸ã该æ件å¯ä»¥å¨JBossçrepositoryä¸æ¾å°ã + å¦å¤ä¸ä¸ªæ¹æ³æ¯ä½¿ç¨é¨ç½²æè¿°æ件ï¼deployment descriptorï¼ï¼å³å¨æ件<literal + >jboss.xml</literal>ä¸å å ¥ç±»ä¼¼ä»¥ä¸çå å®¹ï¼ +<programlisting><message-driven> + <ejb-name>ExampleMDB</ejb-name> + <resource-adapter-name>hornetq-ra.rar</resource-adapter-name> +</message-driven> +</programlisting>ä½ è¿å¯ä»¥å°hornetq-ra.raræ¹å为jms-ra.rarèä¸éè¦ä»»ä½annotationæé¢å¤çé¨ç½²æè¿°ä¿¡æ¯ãä½æ¯ä½ éè¦ + ç¼è¾<literal>jms-ds.xml</literal>æ件ï¼å°å ¶ä¸ç<literal>rar-name</literal>项æ¹æç¸åºçå¼ã</para> + <note> + <para>HornetQæ¯JBoss AS 6é»è®¤çJMSæä¾è ãä»è¿ä¸ªçæ¬å¼å§HornetQçèµæºéé å¨ååæ¯ + <literal>jms-ra.rar</literal>ï¼å¹¶ä¸ä½ ä¸éè¦å¨MDBçannotationä¸æå®å®ã</para> + </note> + <para>HornetQåå¸å ä¸çææä¾åé½ä½¿ç¨annotationæ¹æ³ã</para> + <section> + <title>使ç¨å®¹å¨ç®¡çäºå¡ï¼CMTï¼</title> + <para>å½MDB使ç¨å®¹å¨ç®¡çäºå¡æ¶ï¼æ¶æ¯çä¼ é被å å«å¨ä¸ä¸ªJTAäºå¡ä¸ãäºå¡çæ交ä¸åæ»æ¯ç±å®¹å¨æ¥æ§å¶çãå¦æäºå¡ + 被åæ»ï¼æ¶æ¯ä¼ éä¼è¿è¡ç¸åºçå¤çï¼é»è®¤æ¯éæ°ä¼ éæ¶æ¯ï¼å¦æéæ°ä¼ é次æ°è¶ è¿10次ï¼æ¶æ¯å°±è¢«åå¾DLQï¼ãä½¿ç¨ + annotationé ç½®å¦ä¸ï¼</para> + <programlisting>@MessageDriven(name = "MDB_CMP_TxRequiredExample", + activationConfig = + { + @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), + @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue") + }) +@TransactionManagement(value= TransactionManagementType.CONTAINER) +@TransactionAttribute(value= TransactionAttributeType.REQUIRED) +@ResourceAdapter("hornetq-ra.rar") +public class MDB_CMP_TxRequiredExample implements MessageListener +{ + public void onMessage(Message message)... +}</programlisting> + <para><literal>TransactionManagement</literal> 表示è¿ä¸ªMDB使ç¨å®¹å¨ç®¡çæä¹ æ§ã + <literal>TransactionAttribute</literal> 表示è¿ä¸ªMDBè¦æ±JTAäºå¡ã注æè¿ä¸ªannotationç + å¦å¤å¯ä¸çåæ³å¼æ¯<literal>TransactionAttributeType.NOT_SUPPORTED</literal>ï¼å®è¡¨ç¤º + MDBä¸éè¦JTAäºå¡æ¯æã</para> + <para>å¦æè¦åæ»äºå¡ï¼å¯ä»¥è°ç¨<literal>MessageDrivenContext</literal>ç + <literal>setRollbackOnly</literal>æ¹æ³ãå¦ä¸é¢ç代ç æ示ï¼</para> + <programlisting> @Resource + MessageDrivenContextContext ctx; + + public void onMessage(Message message) + { + try + { + //something here fails + } + catch (Exception e) + { + ctx.setRollbackOnly(); + } + }</programlisting> + <para>å¦æä½ ä¸éè¦ä½¿ç¨XAäºå¡ï¼ä½ å¯ä»¥ç¨ä¸ç¸æ¬å°çäºå¡æ¥ä»£æ¿ï¼æ¯å¦ä½ åªæä¸ä¸ªJMSèµæºï¼ã + å¦ä¸æ示ï¼</para> + <programlisting>@MessageDriven(name = "MDB_CMP_TxLocalExample", + activationConfig = + { + @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), + @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue"), + @ActivationConfigProperty(propertyName = "useLocalTx", propertyValue = "true") + }) +@TransactionManagement(value = TransactionManagementType.CONTAINER) +@TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED) +@ResourceAdapter("hornetq-ra.rar") +public class MDB_CMP_TxLocalExample implements MessageListener +{ + public void onMessage(Message message)... +}</programlisting> + </section> + <section> + <title>使ç¨Bean管çäºå¡ï¼BMTï¼</title> + <para>æ¶æ¯Beanå¯ä»¥éè¿é 置使ç¨Bean管ççäºå¡ï¼BMTï¼ãå¨ç§æ åµä¸ä¼å建ä¸ä¸ªç¨æ·äºå¡ + ï¼User Transactionï¼ãå¦ä¸æ示ï¼</para> + <programlisting>@MessageDriven(name = "MDB_BMPExample", + activationConfig = + { + @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), + @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue"), + @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Dups-ok-acknowledge") + }) +@TransactionManagement(value= TransactionManagementType.BEAN) +@ResourceAdapter("hornetq-ra.rar") +public class MDB_BMPExample implements MessageListener +{ + public void onMessage(Message message) +}</programlisting> + <para>使ç¨BMTæ¶ï¼æ¶æ¯çä¼ éå¨ç¨æ·äºå¡çèå´ä¹å¤ï¼å®çéç¥æ¨¡å¼ç±<literal>acknowledgeMode</literal>åæ°å³å®ã + 该åæ°æ两个åæ³çå¼ï¼å³<literal>Auto-acknowledge</literal>å<literal + >Dups-ok-acknowledge</literal>ã请注æï¼ç±äºæ¶æ¯çä¼ éå¨äºå¡ä¹å¤ï¼å¨MDBä¸å¦æåçé误æ¶æ¯ + æ¯ä¸ä¼éæ°ä¼ éçã</para> + <para>ç¨æ·å¯ä»¥åå¦ä¸æ示æ§å¶äºå¡ççå½å¨æï¼</para> + <programlisting> @Resource + MessageDrivenContext ctx; + + public void onMessage(Message message) + { + UserTransaction tx; + try + { + TextMessage textMessage = (TextMessage)message; + + String text = textMessage.getText(); + + UserTransaction tx = ctx.getUserTransaction(); + + tx.begin(); + + //do some stuff within the transaction + + tx.commit(); + + } + catch (Exception e) + { + tx.rollback(); + } + }</programlisting> + </section> + <section> + <title>å¨MDBä¸ä½¿ç¨éæ©å¨</title> + <para>MDBå¯ä»¥é ç½®æ¶æ¯éæ©å¨ãå¦ä¸æ示ï¼</para> + <programlisting>@MessageDriven(name = "MDBMessageSelectorExample", + activationConfig = + { + @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), + @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue"), + @ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "color = 'RED'") + }) +@TransactionManagement(value= TransactionManagementType.CONTAINER) +@TransactionAttribute(value= TransactionAttributeType.REQUIRED) +@ResourceAdapter("hornetq-ra.rar") +public class MDBMessageSelectorExample implements MessageListener +{ + public void onMessage(Message message).... +}</programlisting> + </section> + </section> + <section> + <title>å¨JEE模åå åéæ¶æ¯</title> + <para>JCAéé å¨æ¯æåéæ¶æ¯ãè¿æ¥å·¥åçé»è®¤é ç½®å¨<literal>jms-ds.xml</literal>æ件ä¸ï¼å¯¹åºçJNDIååæ¯ + <literal>java:/JmsXA</literal>ãå¨JEEä¸ä½¿ç¨å®åéæ¶æ¯å°ä½ä¸ºJTAäºå¡çä¸é¨åæ¥å¯¹å¾ ã</para> + <para>å¦ææ¶æ¯åé失败ï¼æ´ä¸ªäºå¡å°åæ»ï¼æ¶æ¯ä¼è¢«éæ°åéãä¸é¢æ¯ä¸ä¸ªMDBåéæ¶æ¯çä¾åï¼</para> + <programlisting>@MessageDriven(name = "MDBMessageSendTxExample", + activationConfig = + { + @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), + @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue") + }) +@TransactionManagement(value= TransactionManagementType.CONTAINER) +@TransactionAttribute(value= TransactionAttributeType.REQUIRED) +@ResourceAdapter("hornetq-ra.rar") +public class MDBMessageSendTxExample implements MessageListener +{ + @Resource(mappedName = "java:/JmsXA") + ConnectionFactory connectionFactory; + + @Resource(mappedName = "queue/replyQueue") + Queue replyQueue; + + public void onMessage(Message message) + { + Connection conn = null; + try + { + //Step 9. We know the client is sending a text message so we cast + TextMessage textMessage = (TextMessage)message; + + //Step 10. get the text from the message. + String text = textMessage.getText(); + + System.out.println("message " + text); + + conn = connectionFactory.createConnection(); + + Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); + + MessageProducer producer = sess.createProducer(replyQueue); + + producer.send(sess.createTextMessage("this is a reply")); + + } + catch (Exception e) + { + e.printStackTrace(); + } + finally + { + if(conn != null) + { + try + { + conn.close(); + } + catch (JMSException e) + { + } + } + } + } + }</programlisting> + <para>å¨JBossåºç¨æå¡å¨çEJBï¼å æ¬ä¼è¯Bean, å®ä½Beanåæ¶æ¯Beanï¼ãServletï¼å æ¬jspï¼æå®å¶çMBeanä¸ + é½å¯ä»¥ä½¿ç¨JMSçJCAéé å¨æ¥åéæ¶æ¯ã</para> + </section> + <section> + <title>MDBä¸æ¥æ¶æ± ç大å°</title> + <para>å æ¬JBosså¨å çç»å¤§å¤æ°åºç¨æå¡å¨å 许ç¨æ·å®ä¹ä¸ä¸ªæ± ä¸çMDBæ°éãå¨JBossä¸è¿ä¸ªåæ°åæ¯<literal>MaxPoolSize</literal>ï¼å®å¨æ件 + ejb3-interceptors-aop.xmlä¸é ç½®ãè¿ä¸ªåæ°ä¸å½±åå®é å建çä¼è¯ï¼æ¥æ¶è çæ°éãèµæºéé å¨ä¸ç¥éMDBçå ·ä½å®ç°ãæ以å³ä½¿ä½ 设置MDBæ± å¨å¤§å° + 为1ï¼ä»ç¶ä¼æ15个ä¼è¯ï¼æ¥æ¶è 被å建ï¼é»è®¤å¼ï¼ãå¦æä½ æ³æ¹åä¼è¯ï¼æ¥æ¶è å建çæ°éï¼ä½ å¯ä»¥éè¿è®¾ç½®èµæºéé å¨çåæ° + <literal>maxSession</literal>å®ç°ãä¹å¯ä»¥éè¿è®¾ç½®MDBçæ¿æ´»é ç½®åæ°æ¥å®æï¼</para> + <programlisting>@MessageDriven(name = "MDBMessageSendTxExample", + activationConfig = + { + @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), + @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue"), + @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1") + }) +@TransactionManagement(value= TransactionManagementType.CONTAINER) +@TransactionAttribute(value= TransactionAttributeType.REQUIRED) +@ResourceAdapter("hornetq-ra.rar") +public class MyMDB implements MessageListener +{ ....} + </programlisting> + </section> + <section> + <title>é ç½®JCAéé å¨</title> + <para>éè¿JCAéé å¨å¯ä»¥å°HornetQéæå°JEEå ¼å®¹ç模åä¸ï¼å¦MDBåEJBãå®çé ç½®å³å®äºè¿äºæ¨¡åå¦ä½æ¥æ¶ååéæ¶æ¯ã</para> + <para>HornetQçJCAéé å¨æ¯éè¿<literal>jms-ra.rar</literal>é¨ç½²çãå®çé ç½®æ件ä¸å ¶ä¸ç + <literal>META-INF/ra.xml</literal>ã</para> + <para>ä¸é¢æ¯å®çå ·ä½é ç½®å 容ï¼</para> + <programlisting><resourceadapter> + <resourceadapter-class>org.hornetq.ra.HornetQResourceAdapter</resourceadapter-class> + <config-property> + <description>The transport type</description> + <config-property-name>ConnectorClassName</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>org.hornetq.core.remoting.impl.invm.InVMConnectorF + actory</config-property-value> + </config-property> + <config-property> + <description>The transport configuration. These values must be in the form of key=val;key=val;</description> + <config-property-name>ConnectionParameters</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>server-id=0</config-property-value> + </config-property> + + <outbound-resourceadapter> + <connection-definition> + <managedconnectionfactory-class>org.hornetq.ra.HornetQRAManagedConnection + Factory</managedconnectionfactory-class> + + <config-property> + <description>The default session type</description> + <config-property-name>SessionDefaultType</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>javax.jms.Queue</config-property-value> + </config-property> + <config-property> + <description>Try to obtain a lock within specified number of seconds; less + than or equal to 0 disable this functionality</description> + <config-property-name>UseTryLock</config-property-name> + <config-property-type>java.lang.Integer</config-property-type> + <config-property-value>0</config-property-value> + </config-property> + + <connectionfactory-interface>org.hornetq.ra.HornetQRAConnectionFactory + </connectionfactory-interface> + <connectionfactororg.hornetq.ra.HornetQConnectionFactoryImplonFactoryImpl + </connectionfactory-impl-class> + <connection-interface>javax.jms.Session</connection-interface> + <connection-impl-class>org.hornetq.ra.HornetQRASession + </connection-impl-class> + </connection-definition> + <transaction-support>XATransaction</transaction-support> + <authentication-mechanism> + <authentication-mechanism-type>BasicPassword + </authentication-mechanism-type> + <credential-interface>javax.resource.spi.security.PasswordCredential + </credential-interface> + </authentication-mechanism> + <reauthentication-support>false</reauthentication-support> + </outbound-resourceadapter> + + <inbound-resourceadapter> + <messageadapter> + <messagelistener> + <messagelistener-type>javax.jms.MessageListener</messagelistener-type> + <activationspec> + <activationspec-class>org.hornetq.ra.inflow.HornetQActivationSpec + </activationspec-class> + <required-config-property> + <config-property-name>destination</config-property-name> + </required-config-property> + </activationspec> + </messagelistener> + </messageadapter> + </inbound-resourceadapter> + + </resourceadapter></programlisting> + <para>æ´ä¸ªé ç½®å¯ä»¥å为ä¸ä¸ªä¸»è¦é¨å</para> + <orderedlist> + <listitem> + <para>éé å¨çå ¨å±åæ°</para> + </listitem> + <listitem> + <para>éé å¨å¤é¨ï¼outboundï¼é ç½®ãç¨äºå¨JEEç¯å¢ä¸å建JMSèµæºã</para> + </listitem> + <listitem> + <para>éé å¨å é¨ï¼inboundï¼é ç½®ãç¨äºæ§å¶MDBçæ¶æ¯æ¥æ¶ã </para> + </listitem> + </orderedlist> + <section> + <title>éé å¨çå ¨å±åæ°</title> + <para>é¦å çå°ç第ä¸ä¸ªåæ°æ¯<literal>resourceadapter-class</literal>ãè¿æ¯HornetQ + çéé å¨ç±»ãæ¤åæ°ä¸å¯æ´æ¹ã</para> + <para>å¨æ¤ä¹åæ¯å¯é ç½®çåæ°ãå两个é ç½®éé å¨æ使ç¨çä¼ è¾ãå ¶ä½çç¨æ¥é ç½®è¿æ¥å·¥åã</para> + <note><para>ææè¿æ¥å·¥åçåæ°å¨æ²¡æå®ä¹æ¶ä½¿ç¨é»è®¤å¼ãåæ°<literal>reconnectAttempts</literal> + çé»è®¤å¼å-1ï¼è¡¨ç¤ºå¦æè¿æ¥å¤±è´¥ï¼HornetQä¼ä¸åå°å°è¯éæ°è¿æ¥ãè¿ä¸ªåæ°åªéç¨äºå建è¿ç¨ + è¿æ¥çæ åµãå¦ææ¯InVmè¿æ¥å¨ï¼åæ°¸è¿ä¸å¯è½åçè¿æ¥æ éã</para></note> + <para>ä¸é¢ç»åºäºæ¯ä¸ªåæ°ç说æï¼</para> + <table frame="topbot" border="2"> + <title>å ¨å±é ç½®åæ°</title> + <tgroup cols="3"> + <colspec colname="c1" colnum="1"/> + <colspec colname="c2" colnum="2"/> + <colspec colname="c3" colnum="3"/> + <thead> + <row> + <entry>åæ°å</entry> + <entry>åæ°ç±»å</entry> + <entry>åæ°è¯´æ</entry> + </row> + </thead> + <tbody> + <row> + <entry>ConnectorClassName</entry> + <entry>String</entry> + <entry>è¿æ¥å¨çç±»åï¼åè§ <xref + linkend="configuring-transports"/></entry> + </row> + <row> + <entry>ConnectionParameters</entry> + <entry>String</entry> + <entry>ä¼ è¾é ç½®åæ°ãå®çå¼å¿ é¡»æ¯éç¨ + <literal>key1=val1;key2=val2;</literal>çå½¢å¼ãä¸åè¿æ¥å¨æä¸åçåæ°ã</entry> + </row> + <row> + <entry>useLocalTx</entry> + <entry>boolean</entry> + <entry>设为Trueï¼åè¿è¡æ¬å°äºå¡ä¼åã</entry> + </row> + <row> + <entry>UserName</entry> + <entry>String</entry> + <entry>ç¨äºå建è¿æ¥æ¶ä½¿ç¨çç¨æ·å</entry> + </row> + <row> + <entry>Password</entry> + <entry>String</entry> + <entry>ç¨äºå建è¿æ¥æ¶ä½¿ç¨çç¨æ·å¯ç </entry> + </row> + <row> + <entry>BackupConnectorClassName</entry> + <entry>String</entry> + <entry>åçæ éæ¯ä½¿ç¨çå¤ä»½ä¼ è¾</entry> + </row> + <row> + <entry>BackupConnectionParameters</entry> + <entry>String</entry> + <entry>å¤ä»½ä¼ è¾çé ç½®åæ°</entry> + </row> + <row> + <entry><link linkend="configuration.discovery-group.group-address">DiscoveryAddress</link></entry> + <entry>String</entry> + <entry>æå¡å¨èªå¨æ£æµæ使ç¨çåç°ç»ï¼discovery groupï¼å°å</entry> + </row> + <row> + <entry><link linkend="configuration.discovery-group.group-port">DiscoveryPort</link></entry> + <entry>Integer</entry> + <entry>æ£æµæ使ç¨ç端å£å·</entry> + </row> + <row> + <entry><link linkend="configuration.discovery-group.refresh-timeout">DiscoveryRefreshTimeout</link></entry> + <entry>Long</entry> + <entry>å·æ°çæ¶é´ï¼timeoutï¼ãåä½ä¸ºæ¯«ç§</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.discovery-initial-wait-timeout"> + DiscoveryInitialWaitTimeout + </link> + </entry> + <entry>Long</entry> + <entry>æ£æµä¹åæéçå¾ çæ¶é´</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.connection-load-balancing-policy-class-name"> + ConnectionLoadBalancingPolicyClassName</link> + </entry> + <entry>String</entry> + <entry>è´è½½åè¡¡çç¥ä½¿ç¨çç±»</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.discovery-initial-wait-timeout"> + DiscoveryInitialWaitTimeout + </link> + </entry> + <entry>Long</entry> + <entry>åæå¡å¨åépingçå¨æï¼åä½æ¯«ç§</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.connection-ttl">ConnectionTTL</link> + </entry> + <entry>Long</entry> + <entry>è¿æ¥çåæ´»æ¶é´ï¼TTLï¼</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.call-timeout">CallTimeout</link> + </entry> + <entry>Long</entry> + <entry>æ¯ä¸ªæ°æ®å çè°ç¨è¶ æ¶ãåä½æ¯«ç§</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.dups-ok-batch-size">DupsOKBatchSize</link> + </entry> + <entry>Integer</entry> + <entry>Dups OKçæ åµä¸æ¶æ¯æ¹éç大å°ã</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.transaction-batch-size">TransactionBatchSize</link> + </entry> + <entry>Integer</entry> + <entry>å¨äºå¡ä¸åéæ¶æ¯çæ¹é大å°</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.consumer-window-size">ConsumerWindowSize</link> + </entry> + <entry>Integer</entry> + <entry>æ¥æ¶è å é¨ç¼åççªå£å¤§å°</entry> + </row> + </tbody> + </tgroup> + </table> + <para>æ¥ä¸é¡µ..</para> + <informaltable frame="topbot"> + <tgroup cols="3"> + <colspec colname="c1" colnum="1"/> + <colspec colname="c2" colnum="2"/> + <colspec colname="c3" colnum="3"/> + <tbody> + <row> + <entry> + <link linkend="configuration.connection-factory.consumer-max-rate">ConsumerMaxRate</link> + </entry> + <entry>Integer</entry> + <entry>æ¥æ¶è æ¥æ¶æ¶æ¯çæ大é度</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.confirmation-window-size">ConfirmationWindowSize</link> + </entry> + <entry>Integer</entry> + <entry>ç¨äºç¡®è®¤ççªå£å¤§å°</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.producer-max-rate">ProducerMaxRate</link> + </entry> + <entry>Integer</entry> + <entry>åéè åéæ¶æ¯çæ大é度</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.min-large-message-size">MinLargeMessageSize</link> + </entry> + <entry>Integer</entry> + <entry>大æ¶æ¯çæå°æ°å¼ï¼åä½åèã</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.block-on-acknowledge">BlockOnAcknowledge</link> + </entry> + <entry>Boolean</entry> + <entry>å¦æ为trueï¼è¡¨ç¤ºä»¥é»å¡æ¹æ³åéæ¶æ¯éç¥ã</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.block-on-non-durable-send">BlockOnNonDurableSend</link> + </entry> + <entry>Boolean</entry> + <entry>å¦æ为trueï¼è¡¨ç¤ºä»¥é»å¡æ¹å¼åééæä¹ æ¶æ¯</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.block-on-durable-send">BlockOnDurableSend</link> + </entry> + <entry>Boolean</entry> + <entry>å¦æ为trueï¼è¡¨ç¤ºä»¥é»å¡æ¹å¼åéæä¹ æ¶æ¯</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.auto-group">AutoGroup</link> + </entry> + <entry>Boolean</entry> + <entry>å¦æ为trueï¼è¡¨ç¤ºèªå¨æ¶æ¯åç»</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.pre-acknowledge">PreAcknowledge</link> + </entry> + <entry>Boolean</entry> + <entry>å³å®æ¯å¦è¿è¡æ¶æ¯çé¢å éç¥ï¼pre-acknowledgeï¼ã</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.reconnect-attempts">ReconnectAttempts</link> + </entry> + <entry>Integer</entry> + <entry>è¿æ¥éè¯ç次æ°ï¼é»è®¤ä¸º -1</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.retry-interval">RetryInterval</link> + </entry> + <entry>Long</entry> + <entry>æ¯æ¬¡è¿æ¥éè¯åçå¾ çæ¶é´ï¼åä½æ¯«ç§ã</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.retry-interval-multiplier">RetryIntervalMultiplier</link> + </entry> + <entry>Double</entry> + <entry>ç¨äºè®¡ç®éè¯é´é</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.failover-on-server-shutdown">FailoverOnServerShutdown</link> + </entry> + <entry>Boolean</entry> + <entry>å¦æ设为true表示å°è¯è¿æ¥å ¶å®çæå¡å¨</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.client-id">ClientID</link> + </entry> + <entry>String</entry> + <entry>è¿æ¥ç客æ·ç«¯ID</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.client-failure-check-period">ClientFailureCheckPeriod</link> + </entry> + <entry>Long</entry> + <entry>客æ·ç«¯å¦æå¨è¿ä¸ªæ¶é´å 没ææ¶å°æå¡å¨æ°æ®å ï¼å°è®¤ä¸ºè¿æ¥åºç°æ éã</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.use-global-pools">UseGlobalPools</link> + </entry> + <entry>Boolean</entry> + <entry>æ¯å¦ä½¿ç¨å ¨å±çº¿ç¨æ± </entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.scheduled-thread-pool-max-size">ScheduledThreadPoolMaxSize</link> + </entry> + <entry>Integer</entry> + <entry><emphasis>å¯è®¡å线ç¨æ± </emphasis>çæ大线ç¨æ°</entry> + </row> + <row> + <entry> + <link linkend="configuration.connection-factory.thread-pool-max-size">ThreadPoolMaxSize</link> + </entry> + <entry>Integer</entry> + <entry>线ç¨æ± ç大å°</entry> + </row> + <row> + <entry>SetupAttempts</entry> + <entry>Integer</entry> + <entry>å°è¯å»ºç«JMSè¿æ¥ç次æ°ï¼é»è®¤å¼æ¯10ã-1表示æ é次è¿è¡å°è¯ï¼ãææ¶MDBå¨é¨ç½²æ¶ç¸å ³çJMSèµæºè¿æ²¡æåå¤å¥½ï¼è¿æ¶éè¿å¤æ¬¡ç +ãããããããããããããããããããå°è¯ç´å°JMSèµæºè¿æ¥ä¸ä¸ºæ¢ãåªéç¨äºå é¨ï¼Inboundï¼è¿æ¥çæ åµã</entry> + </row> + <row> + <entry>SetupInterval</entry> + <entry>Long</entry> + <entry>æ¯ä¸¤æ¬¡ç¸é»å°è¯ä¹é´çæ¶é´é´éï¼ä»¥æ¯«ç§ä¸ºåä½ï¼é»è®¤å¼ä¸º2000毫ç§ï¼ãåªéç¨äºå é¨ï¼Inboundï¼è¿æ¥çæ åµã</entry> + </row> + </tbody> + </tgroup> + </informaltable> + </section> + <section> + <title>éé å¨å¤é¨ï¼outboundï¼é ç½®</title> + <para>å¤é¨é ç½®åæ°åºè¯¥ä¿æä¸åãè¿æ¯å 为å®æå®ä¹çè¿æ¥å·¥åè¦è¢«Java EEç模åæ使ç¨ãè¿äºè¿æ¥å·¥å + å¯ä»¥å®ä¹å¨ååæ ·å¼ä¸º<literal>*-ds.xml</literal>çé ç½®æ件ä¸ãå¨JBossçé¨ç½²ç®å½ + <literal>hornetq.sar</literal>ä¸æä¸ä¸ªé»è®¤çé ç½®æ件<literal>jms-ds.xml</literal>ã + å¨è¿ä¸ªæ件ä¸çè¿æ¥å·¥åçé ç½®ä»ä¸»è¦çé ç½®æ件<literal>ra.xml</literal>ä¸ç»§æ¿ï¼ + ä½æ¯å¯ä»¥å¨è¿ééæ°å®ä¹ãä¸é¢çä¾åä¸ç»åºäºéæ°å®ä¹çæ¹æ³ã</para> + <note> + <para>请注æè¿éçé ç½®åªéç¨äºå¨JBossåºç¨æå¡å¨ä¸å®è£ çHornetQãå¦æè¦å¨å ¶å®JEEåºç¨æå¡å¨ä¸ + 使ç¨å¹¶é ç½®HornetQï¼è¯·åç §ç¸åºçåºç¨æå¡å¨æåã</para> + </note> + <programlisting><tx-connection-factory> + <jndi-name>RemoteJmsXA</jndi-name> + <xa-transaction/> + <rar-name>jms-ra.rar</rar-name> + <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory +</connection-definition> + <config-property name="SessionDefaultType" type="String">javax.jms.Topic + </config-property> + <config-property name="ConnectorClassName" type="String"> + org.hornetq.core.remoting.impl.netty.NettyConnectorFactory + </config-property> + <config-property name="ConnectionParameters" type="String"> + port=5445</config-property> + <max-pool-size>20</max-pool-size> +</tx-connection-factory></programlisting> + <para>ä¸é¢çä¾åä¸çè¿æ¥å·¥åç»å®å°JNDIåå<literal>RemoteJmsXA</literal>ãEJBåMDBå¯ä»¥ç¨ + ä¸é¢çæ¹æ³æ¥å¾å°å®ï¼</para> + <programlisting>@Resource(mappedName="java:RemoteJmsXA") +private ConnectionFactory connectionFactory;</programlisting> + <para><literal>config-property</literal>è¦çäº<literal>ra.xml</literal>æ件ä¸çé ç½®ã + 以æ¤ç±»æ¨ï¼å ¶å®æå ³è¿æ¥å·¥åçåæ°ä¹å¯ä»¥å¨æ¤è¦çã</para> + <para>é¤äºå ¨å±çé ç½®åæ°å¤ï¼å¤é¨çé ç½®è¿å®ä¹äºå ¶å®ä¸äºåæ°ã</para> + + <table frame="topbot" border="2"> + <title>å¤é¨é ç½®åæ°</title> + <tgroup cols="3"> + <colspec colname="c1" colnum="1"/> + <colspec colname="c2" colnum="2"/> + <colspec colname="c3" colnum="3"/> + <thead> + <row> + <entry>åæ°å</entry> + <entry>åæ°ç±»å</entry> + <entry>说æ</entry> + </row> + </thead> + <tbody> + <row> + <entry>SessionDefaultType</entry> + <entry>String</entry> + <entry>é»è®¤çä¼è¯ç±»å</entry> + </row> + <row> + <entry>UseTryLock</entry> + <entry>Integer</entry> + <entry>å¨è§å®çç§æ°å è·å¾éãå¦æä¸æ³ä½¿ç¨è¿ä¸ªåè½ï¼å°å®è®¾ä¸º0æè´æ°</entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section> + <title>éé å¨å é¨ï¼inboundï¼é ç½®</title> + <para>å é¨é ç½®åæ°ä¹åºè¯¥ä¿æä¸åãå®ä»¬æ§å¶åMDB转åæ¶æ¯çåç§å±æ§ãéè¿å¨MDBä¸æ·»å ç¸åºçæ¿æ´»é ç½® + ï¼activation configurationï¼å¯ä»¥è¦çè¿äºåæ°çå¼ãå®å¯ä»¥ç¨æ¥é ç½®ä¸ä¸ªMDBä»å¦å¤ä¸ä¸ªæå¡å¨ + æ¥æ¶æ¶æ¯ã</para> + <para>é¤äºå ¨å±çé ç½®åæ°å¤ï¼å é¨çé ç½®è¿å®ä¹äºå ¶å®ä¸äºåæ°ã</para> + + <table frame="topbot" border="2"> + <title>Inbound Configuration Properties</title> + <tgroup cols="3"> + <colspec colname="c1" colnum="1"/> + <colspec colname="c2" colnum="2"/> + <colspec colname="c3" colnum="3"/> + <thead> + <row> + <entry>åæ°å</entry> + <entry>åæ°ç±»å</entry> + <entry>说æ</entry> + </row> + </thead> + <tbody> + <row> + <entry>Destination</entry> + <entry>String</entry> + <entry>ç®æ çJNDIåå</entry> + </row> + <row> + <entry>DestinationType</entry> + <entry>String</entry> + <entry>ç®æ çç±»åï¼<literal>javax.jms.Queue</literal>æè <literal>javax.jms.Topic</literal> + (é»è®¤æ¯javax.jms.Queue)</entry> + </row> + <row> + <entry>AcknowledgeMode</entry> + <entry>String</entry> + <entry>éç¥æ¨¡å¼ï¼<literal>Auto-acknowledge</literal> æ <literal>Dups-ok-acknowledge</literal> + (é»è®¤å¼æ¯Auto-acknowledge). <literal>AUTO_ACKNOWLEDGE</literal>å<literal>DUPS_OK_ACKNOWLEDGE</literal>ä¹æ¯ææå¼</entry> + </row> + <row> + <entry>MaxSession</entry> + <entry>Integer</entry> + <entry>å é¨é ç½®å建çæ大ä¼è¯æ°ï¼é»è®¤æ¯5ï¼</entry> + </row> + <row> + <entry>MessageSelector</entry> + <entry>String</entry> + <entry>æ¥æ¶è çæ¶æ¯éæ©å¨</entry> + </row> + <row> + <entry>SubscriptionDurability</entry> + <entry>String</entry> + <entry>订é çç±»åï¼<literal>Durable</literal>æè <literal>NonDurable</literal></entry> + </row> + <row> + <entry>SubscriptionName</entry> + <entry>String</entry> + <entry>订é çåå</entry> + </row> + <row> + <entry>TransactionTimeout</entry> + <entry>Long</entry> + <entry>äºå¡è¶ æ¶ï¼æ¯«ç§ï¼é»è®¤æ¯0ï¼è¡¨ç¤ºäºå¡ä¸ä¼è¶ æ¶ï¼</entry> + </row> + <row> + <entry>UseJNDI</entry> + <entry>Boolean</entry> + <entry>æ¯å¦ä½¿ç¨JNDIæ¥æ¥æ¾ç®æ ï¼é»è®¤æ¯trueï¼</entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section> + <title>é ç½®éé å¨è®¿é®åç¬çHornetQæå¡å¨</title> + <para>å¨æçæ åµä¸ï¼æ¶æ¯æå¡å¨ä¸åºç¨æå¡å¨è¿è¡å¨ä¸åçæºå¨ä¸ãè¿æ¶å®¢æ·ç«¯åªéè¦å®è£ HornetQç客æ·ç«¯çåºæ件ãæ¬èç»åºäºå ·ä½çé ç½®åæéè¦çjaræ件ã</para> + <section> + <para>ä½ éè¦é 置两个é ç½®æ件ãä¸ä¸ªæ¯MDBæç¨çå é¨éé å¨ï¼å¦ä¸ä¸ªæ¯å¯ä»¥å建å¤é¨è¿æ¥çå¤é¨éé å¨ã</para> + <section> + <title>é ç½®å é¨éé å¨</title> + <para>é¦å å¨<literal>deploy</literal>ç®å½ä¸å建ä¸ä¸ªä»¥.rar为ç»å°¾çæ件夹ã + å¨è¿éæ们å°å ¶å½å为<literal>hornetq-ra.rar</literal>ã主注æè¿ä¸ç¹å¾éè¦ï¼å 为MDBåå¤é¨é ç½®é½éè¦å¼ç¨ + 该æ件夹çååã + </para> + <note> + <para>å¨JBossä¸è¯¥æ件夹çé»è®¤å为<literal>jms-ra.rar</literal>ãä½ å¯ä»¥ç´æ¥ä½¿ç¨è¿ä¸ªååãä½æ¯ä½ å¯è½éè¦é¿å + ä¸å ¶å®çéç¨éé å¨ç¸å²çªã + </para> + </note> + <para>å¨æ件夹 + <literal>hornetq-ra.rar</literal> + ä¸å建å为 + <literal>META-INF</literal> + çæ件夹ï¼ç¶åå¨äºæ件夹å å建ä¸ä¸ª + <literal>ra.xml</literal>é ç½®æ件ãå¨HornetQåå¸å ä¸ + æä¸ä¸ª<literal>ra.xml</literal>模æ¿æ件ä¾ä½ 使ç¨ã + </para> + <para>è¦é ç½®MDBæ¥æ¶è¿ç¨HornetQæå¡å¨çæ¶æ¯ï¼ä½ éè¦ä¿®æ¹<literal>deploy/hornet-ra.rar/META-INF</literal>ä¸é¢ç + <literal>ra.xml</literal>æ件ï¼å°ä¼ è¾å±æ¹ä¸ºnettyè¿æ¥å¨ï¼ä¸è¦ä½¿ç¨invmè¿æ¥å¨ï¼åå ¶ç¸åºçåæ°ãä¸é¢ + æ¯ä¸ä¸ªé ç½®çä¾åï¼ + </para> + + <programlisting> + <resourceadapter-class>org.hornetq.ra.HornetQResourceAdapter</resourceadapter-class> + <config-property> + <description>The transport type</description> + <config-property-name>ConnectorClassName</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</config-property-value> + </config-property> + <config-property> + <description>The transport configuration. These values must be in the form of key=val;key=val;</description> + <config-property-name>ConnectionParameters</config-property-name> + <config-property-type>java.lang.String</config-property-type> + <config-property-value>host=127.0.0.1;port=5446</config-property-value> + </config-property> + </programlisting> + <para>ä¸é¢çé ç½®ä¸ï¼éé å¨è¿æ¥å°ä¸ä¸ªè¿è¡å¨æ¬æºä¸ç«¯å£ä¸º5446çæå¡å¨ã</para> + </section> + + <section> + <title>é ç½®å¤é¨éé å¨</title> + <para>ä½ è¿éè¦å建ä¸ä¸ª<literal>hornetq-ds.xml</literal>æ件æ¥é ç½®å¤é¨è¿æ¥ã该æ件éè¦æ¾ç½®å¨<literal>deploy</literal> + ä¸çä»»æä¸ä¸ªæ件夹ä¸ãå¨ä¸ç¸æ åçå®è£ ä¸è¿ä¸ªæ件夹æ¯<literal>horneq</literal> æè <literal>hornetq.sar</literal>ã + å½ç¶ä½ å¯ä»¥éæ©å ¶å®æ件夹ã该æ件çåååªè¦æ¯ä»¥<literal>-ds.xml</literal>å³å¯ãå¨HornetQçåå¸å ä¸å å«æä¸ä¸ªæ¨¡æ¿æä»¶ï¼ + å®çååæ¯<literal>jms-ds.xml</literal>ï¼ä½ç½®å°±å¨configæ件夹ä¸ã + </para> + <para>ä¸é¢æ¯ä¸ä¸ªé ç½®çä¾åã</para> + <programlisting> + <tx-connection-factory> + <jndi-name>RemoteJmsXA</jndi-name> + <xa-transaction/> + <rar-name>hornetq-ra.rar</rar-name> + <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition> + <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property> + <config-property name="ConnectorClassName" type="java.lang.String">org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</config-property> + <config-property name="ConnectionParameters" type="java.lang.String">host=127.0.0.1;port=5446</config-property> + <max-pool-size>20</max-pool-size> + </tx-connection-factory> + </programlisting> + <para>è¿ä¸ªé ç½®åæ ·æ¯è¿æ¥å°è¿è¡å¨æ¬æºä¸ç端å£ä¸º5446çHornetQæå¡å¨ãJEE模åå¯ä»¥éè¿JNDIæ¥æ¾ + <literal>java:/RemoteJmsXA</literal>ï¼ç±<literal>jndi-name</literal>åæ°å®ä¹ï¼ãå¦ä¸èæè¿°ï¼ + èµæºéé å¨æ ¹æ®æ件夹ä¸çé ç½®æ¥å建å¤é¨è¿æ¥ã</para> + <section> + <title>ä¾èµçjaræ件</title> + <para>ä¸é¢ååºäºHornetQæéè¦ç第ä¸æ¹jaræ件</para> + <table frame="topbot" border="2"> + <title>Jaræ件</title> + <tgroup cols="3"> + <colspec colname="c1" colnum="1"/> + <colspec colname="c2" colnum="2"/> + <colspec colname="c3" colnum="3"/> + <thead> + <row> + <entry>Jaræ件å</entry> + <entry>说æ</entry> + <entry>ä½ç½®</entry> + </row> + </thead> + <tbody> + <row> + <entry>hornetq-ra.jar</entry> + <entry>HornetQèµæºéé å¨æ件</entry> + <entry>deploy/hornetq-ra.raræç¸åºçä½ç½®</entry> + </row> + <row> + <entry>hornetq-core-client.jar</entry> + <entry>HornetQæ ¸å¿å®¢æ·ç±»åº</entry> + <entry>å¨JBossçdefault/libä¸æè æ¯$JBOSS_HOME/common/libä¸ã </entry> + </row> + <row> + <entry>hornetq-jms-client.jar</entry> + <entry>HornetQçJMSç±»</entry> + <entry>åä¸</entry> + </row> + <row> + <entry>netty.jar</entry> + <entry>Nettyç±»åº</entry> + <entry>åä¸</entry> + </row> + </tbody> + </tgroup> + </table> + </section> + </section> + </section> + </section> + <section> + <title>é«å¯è·å¾æ§JNDI (HA-JNDI)</title> + <para>éç¨JNDIæ¥æ¥æ¾JMS对象æ¶ï¼éåï¼è¯é¢åè¿æ¥å·¥åï¼ï¼ä½¿ç¨HAï¼JNDIå¯ä»¥å¢å 容éçè½åãå³å½ä½ æ£å¨ä½¿ç¨ + çJNDIæå¡å¨åçæ éæ¶ï¼å®¢æ·ç«¯å¯ä»¥ä½¿ç¨é群ä¸çå ¶å®JNDIæå¡å¨ç»§ç»å·¥ä½ã</para> + <para>HA-JNDIæ¯JBossåºç¨æå¡å¨çä¸é¡¹æå¡ï¼å®ä¸ºå®¢æ·ç«¯æä¾JNDIæå¡ï¼å®¢æ·ç«¯æ éç¥éJNDIå ·ä½æå¡å¨çè¿æ¥ + ç»èãè¿ä¸ªæå¡åªæå¨é群çJBossåºç¨æå¡å¨ä¸æå¯ä½¿ç¨ã</para> + <para>è¦ä½¿ç¨HAï¼JNDIï¼éè¦ä½¿ç¨ä¸é¢çJNDIåæ°ã</para> + <programlisting>Hashtable<String, String> jndiParameters = new Hashtable<String, String>(); +jndiParameters.put("java.naming.factory.initial", + "org.jnp.interfaces.NamingContextFactory"); +jndiParameters.put("java.naming.factory.url.pkgs=", + "org.jboss.naming:org.jnp.interfaces"); + +initialContext = new InitialContext(jndiParameters);</programlisting> + <para>æå ³HA-JNDIæ´å¤çä¿¡æ¯è¯·åè§<ulink + url="http://www.jboss.org/file-access/default/members/jbossas/freezone/docs/Clustering_Guide/5/html/clustering-jndi.html" + >JBossåºç¨æå¡å¨é群ææ¡£</ulink>ã</para> + </section> + <section id="xa-recovery"> + <title>XAæ¢å¤</title> + <para><emphasis>XAæ¢å¤</emphasis>解å³çæ¯äºå¡å¨ç³»ç»æåºç¨åºç°æ éæ¶çå¤çãå®å¯ä»¥ä¿è¯å¨åºç¨è¿ç¨æ主æºåºç°æ é + æç½ç»å´©æºçæ åµä¸ï¼äºå¡å ææèµæºçç¶æçä¸è´æ§ãæå ³XAæ¢å¤çæ´å¤ä¿¡æ¯è¯·è§ <ulink + url="http://www.jboss.org/community/wiki/JBossTransactions">JBoss + äºå¡</ulink>ã</para> + <para>å½HornetQä¸JBossåºç¨æå¡å¨éææ¶ï¼å®å¯ä»¥å©ç¨JBossçäºå¡å¤çæ¥å¯¹æ¶æ¯èµæºè¿è¡æ¢å¤ãå¦ææ¶æ¯å¤çå æ¬ + å¨ä¸ä¸ªXAäºå¡ä¸ï¼å¦ææå¡å¨åºç°æ é并éå¯æ¶ï¼æ¢å¤ç®¡çå¨å°è´è´£æ¢å¤äºå¡ï¼è¿æ ·å ¶ä¸çæ¶æ¯è¦ä¹è¢«æ交ï¼è¦ä¹è¢«åæ»ï¼å + å³äºäºå¡çå¤çå³å®ï¼ã</para> + <section> + <title>XAæ¢å¤çé ç½®</title> + <para>è¦æ³HornetQå ·æXAæ¢å¤åè½ï¼åå¿ é¡»é ç½®æ¢å¤ç®¡çå¨è¿æ¥å°HornetQ并æ¢å¤å ¶èµæºãä¸é¢çåæ°å¿ é¡»è¦å å° + <literal>conf/jbossts-properties.xml</literal>æ件ä¸ç<literal>jta</literal>é¨å:</para> + <programlisting> +<properties depends="arjuna" name="jta"> + ... + + <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.HornetQ1" + value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;[è¿æ¥é ç½®]"/> +</properties> + </programlisting> + <para>å ¶ä¸<literal>[è¿æ¥é ç½®]</literal>å æ¬è¿æ¥HornetQèç¹æå¿ éçä¿¡æ¯ã + å®çæ ¼å¼æ¯<literal>[è¿æ¥å·¥åç±»å],[ç¨æ·å], [å¯ç ], [è¿æ¥åæ°]</literal>ã </para> + <itemizedlist> + <listitem> + <para><literal>[è¿æ¥å·¥åç±»å]</literal>æçæ¯<literal>ConnectorFactory</literal> + çç±»åï¼ç¨æ¥è¿æ¥HornetQæå¡å¨ãå ¶å¼å¯ä»¥æ¯<literal + >org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</literal> æ + <literal + >org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</literal></para> + </listitem> + <listitem> + <para><literal>[ç¨æ·å]</literal>æ¯ç¨äºå建客æ·ä¼è¯çç¨æ·åãæ¯å¯é项ã</para> + </listitem> + <listitem> + <para><literal>[å¯ç ]</literal>æ¯å建客æ·ä¼è¯æ¶æç¨çå¯ç ãåªæå¨ç¨æ·ååå¨æ¶éè¦ã</para> + </listitem> + <listitem> + <para><literal>[è¿æ¥åæ°]</literal> æ¯ç¨éå·åéçä¸ä¸²é®ï¼å¼å¯¹ãå®ä»¬ä¼ä¼ éç»è¿æ¥å¨å·¥å + ï¼åè§ <xref linkend="configuring-transports"/>ï¼ã</para> + </listitem> + </itemizedlist> + <note> + <para>HornetQå¿ é¡»æä¸ä¸ªä¸<literal>conf/jbossts-properties.xml</literal>ä¸å®ä¹çè¿æ¥å¨ç¸å¯¹åºçæ¥åå¨ï¼acceptorï¼ã</para> + </note> + <section> + <title>é ç½®åæ°</title> + <para>å¦æHornetQé ç½®äºä¸ä¸ªé»è®¤çin-vmæ¥åå¨ï¼</para> + <programlisting> +<acceptor name="in-vm"> + <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class> +</acceptor> + </programlisting> + <para>ç¸åºå°å¨ <literal + >conf/jbossts-properties.xml</literal>æ件ä¸ï¼</para> + <programlisting> +<property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.HORNETQ1" + value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"/> + </programlisting> + <para>å¦æé ç½®äºä¸ä¸ªnettyæ¥åå¨ï¼å¹¶ä¸ç«¯å£ä¸æ¯é»è®¤çï¼</para> + <programlisting> +<acceptor name="netty"> + <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class> + <param key="port" value="8888"/> +</acceptor> + </programlisting> + <para>ç¸åºçå¨ <literal + >conf/jbossts-properties.xml</literal>æ件ä¸ï¼</para> + <programlisting> +<property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.HORNETQ1" + value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;org.hornetq.core.remoting.impl.netty.NettyConnectorFactory, , , port=8888"/> + </programlisting> + <note> + <para>注æå¨æ²¡æç¨æ·ååå¯ç æ¶ï¼éå·æ¯ä¸è½çç¥çã</para> + </note> + <para>å¦ææ¢å¤å¿ é¡»è¦æ±æ¯<literal>admin, adminpass</literal>ï¼åå ¶é ç½® + åºä¸ºå¦ä¸æ示ï¼</para> + <programlisting> + <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.HORNETQ1" + value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;org.hornetq.core.remoting.impl.netty.NettyConnectorFactory, admin, adminpass, port=8888"/> + </programlisting> + <para>æ¨èå¨XAæ¢å¤ä¸ï¼å°HornetQé ç½®ä¸ä¸ªinvmæ¥åå¨ï¼å¹¶é ç½®æ¢å¤ç®¡çå¨ä½¿ç¨invmè¿æ¥å¨ã</para> + </section> + </section> + <section> + <title>ä¾å</title> + <para>åè§<xref linkend="xa-recovery-example"/>ãè¿ä¸ªä¾åå±ç¤ºäºå¦ä½æ¥é ç½®XAæ¢å¤ä»¥ä¾¿å¨æå¡å¨å´©æºåæ¢å¤æ¶æ¯ã</para> + </section> + </section> + </section> +</chapter> http://git-wip-us.apache.org/repos/asf/activemq-6/blob/8ecd255f/docs/user-manual/zh/architecture.xml ---------------------------------------------------------------------- diff --git a/docs/user-manual/zh/architecture.xml b/docs/user-manual/zh/architecture.xml new file mode 100644 index 0000000..d8d12a2 --- /dev/null +++ b/docs/user-manual/zh/architecture.xml @@ -0,0 +1,95 @@ +<?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="architecture"> + <title>æ»ä½æ¶æ</title> + <para>æ¬ç« 对HornetQçæ»ä½ææ¯æ¶æè¿è¡äºæ¦æ¬æè¿°ã</para> + <section> + <title>æ ¸å¿æ¶æ</title> + <para>HornetQçæ ¸å¿æ¯ç±ä¸ç»ç®åJava对象ï¼POJOï¼ææçãåæ¶å¨è®¾è®¡HornetQæ¶å°å¯¹å¤é¨jarå çä¾èµéå°æä½é度ã + å®é ä¸HornetQçæ ¸å¿é¨ååªæä¸ä¸ªå¤é¨ä¾èµï¼å°±æ¯netty.jarãHornetQ使ç¨äºå ¶ä¸çç¨äºç¼å²çä¸äºç±»ã + æ们ç¸ä¿¡è¿æ ·çç念åºè¯¥åå°ç¨æ·ç欢è¿ã</para> + <para>ç±äºä¾èµæ§å¾å°ï¼HornetQå¯ä»¥é常容æå°åµå ¥å°å ¶å®åºç¨ä¸ï¼æè å å ¥å°ä¸äºä¾èµæ³¨å ¥å¼çæ¡æ¶ä¸ï¼ + å¦JBoss Microcontainerï¼SpringæGoogle Guiceã</para> + <para>æ¯ä¸ªHornetQæå¡å¨é½æèªå·±çè¶ é«æ§è½çæä¹ æ¥å¿ï¼journalï¼ç¨äºæ¶æ¯åå ¶å®ä¿¡æ¯çæä¹ åã</para> + <para>éç¨è¿ç§ç¬ç¹çé«ææ¥å¿è¦æ¯éç¨æ®éæ°æ®åºä½ä¸ºæä¹ å±çç³»ç»æ¥ææ´é«çæ§è½ã</para> + <para>é常æ åµä¸åå¸å¨ä¸åç©çæºå¨ä¸ç客æ·ç«¯åæ¶è®¿é®HornetQæå¡å¨ãç®åHornetQæä¾äºä¸¤å¥APIä¾å®¢æ·ç«¯ä½¿ç¨ï¼</para> + <para> + <orderedlist> + <listitem> + <para>æ ¸å¿APIãè¿æ¯ä¸ç»æ®éçJavaæ¥å£ï¼ç¨å®å¯ä»¥è®¿é®HornetQçå ¨é¨åè½ã</para> + </listitem> + <listitem> + <para>JMS客æ·ç«¯APIãè¿æ¯æ åçJMS APIã</para> + </listitem> + </orderedlist> + </para> + <para>å®é ä¸JMS APIæ¯å¨æ ¸å¿APIçå¤é¨å ä¸ä¸å±ç®åçå°è£ ã</para> + <para>å¨HornetQå æ ¸æ¯æ²¡æJMSçï¼è¿æ ·è®¾è®¡çç®çæ¯ä¸ºäºæ¯æå¤ä¸ªåè®®ã</para> + <para>å½å®¢æ·ç«¯éè¿JMSæ¥å£è®¿é®HornetQæ¶ï¼ææJMSçæä½é½è¢«è½¬æ¢æç¸åºçæ ¸å¿APIï¼ç¶åå°è¯·æ±ä»¥HornetQæ ¼å¼ååæå¡å¨ã</para> + <para>HornetQæå¡å¨åªæ¥æ¶æ ¸å¿APIç访é®ã</para> + <para>å¾3.1æè¿°äºè¿äºæä½ã</para> + <para> + <graphic fileref="images/architecture1.jpg" align="center"/> + </para> + <para>å¨å¾3.1ä¸ç¤ºåºäºä¸¤ä¸ªç¨æ·è®¿é®HornetQæå¡å¨ãç¨æ·1使ç¨JMS APIï¼ç¨æ·2使ç¨çæ¯æ ¸å¿APIã</para> + <para>å¾ä¸æ¸ æ¥çå±ç¤ºåºäºJMSæ¯å¦ä½éè¿å°è£ ï¼facadeï¼è½¬åä¸ºæ ¸å¿APIçã</para> + </section> + <section> + <title>å°HornetQåµå ¥å°ä½ çåºç¨ç¨åºä¸</title> + <para>å¦æä½ çåºç¨ç¨åºå é¨éè¦æ¶æ¯æå¡ï¼ä½åæ¶ä½ åä¸æ³å°æ¶æ¯æå¡æ´é²ä¸ºåç¬çHornetQæå¡å¨ï¼ä½ å¯ä»¥å¨åºç¨ä¸ç´æ¥å°HornetQå®ä¾åã</para> + <para>æå ³åµå ¥å¼HornetQç详ç»ä¿¡æ¯è¯·åé <xref linkend="embedding-hornetq" + />ã</para> + </section> + <section> + <title>å°HornetQä¸JEEåºç¨æå¡å¨éæ</title> + <para>HornetQæä¾äºæ åçJCAéé å¨ï¼å©ç¨å®å¯ä»¥å°HornetQè½»æ¾å°éæå°ä»»ä½ä¸ä¸ªç¬¦åJEEè§èçåºç¨æå¡å¨æservlet容å¨ä¸ã</para> + <para>JEEåºç¨æå¡åæä¾äºæ¶æ¯Beanï¼MDBï¼ç¨äºå¤çæ¥èªå¤é¨çæ¶æ¯ï¼æ¯å¦æ¥èªJMSç³»ç»æé®ä»¶ç³»ç»çæ¶æ¯ã</para> + <para>æ常è§çåºç¨åºè¯¥æ¯ç¨MDBæ¥æ¥æ¶æ¥èªJMSç³»ç»ä¸çæ¶æ¯äºãå¨JEEè§èä¸è§å®äºJEEåºç¨æå¡å¨ä½¿ç¨JCA adaptorä¸JMSæ¶æ¯ç³»ç»éæï¼ + MDBéè¿è¿ä¸ªadaptoræ¥æ¥æ¶æ¶æ¯ã</para> + <para>JCA adaptorä¸ä» å¯ä»¥ç¨æ¥æ¥æ¶æ¶æ¯ï¼è¿å¯ä»¥ç¨æ¥ä»EJBæservletä¸åå¤é¨çJMSåéæ¶æ¯ãå¨JEEåºç¨æå¡å¨ä¸åºè¯¥ç¨JCA adaptorä¸JMSç³»ç»è¿è¡äº¤äºã + å®é ä¸JEEè§èä¸ä¸å 许å¨JEEæå¡å¨ä¸ä¸éè¿JCAèç´æ¥è®¿é®JMSç³»ç»ã</para> + <para>å¨EJBä¸ä½¿ç¨æ¶æ¯å¾å¾éè¦è¿æ¥æ± æ交æï¼èJCAå¯ä»¥æä¾è¿æ¹é¢çæå¡ï¼æ éé¢å¤çå¼åä»»å¡ãå½ç¶ç´æ¥è®¿é®JMSç³»ç»æ¯å¯è½çï¼ + ä½æ¯ä½ å°ä¸è½å©ç¨JCAææä¾çè¿äºæç¨çåè½ï¼å æ¤æ们ä¸å»ºè®®ä½¿ç¨ç´æ¥è®¿é®çæ¹å¼ã</para> + <para>å¾3.2ç»åºäºHornetQéè¿JCA adaptorä¸JEEåºç¨æå¡å¨éæç示æå¾ãå¾ä¸å¯ä»¥çåºææç交äºé½éè¿JCA adaptorã</para> + <para>å¾ä¸å¸¦æç¦æ¢ç¬¦å·çç®å¤´è¡¨æçæ¯ä»EJBä¼è¯Beanç´æ¥è®¿é®HornetQçæ åµãç±äºä¸éè¿JCAï¼è¿ç§æ¹æ³å¾å¾é ææ¯æ¬¡EJB访é®HornetQé½è¦æ°å»ºä¸ä¸ªè¿æ¥åä¼è¯ï¼ + 使æç大éä½ãè¿è¢«è§ä¸ºå设计模å¼ï¼anti-patternï¼ã</para> + <para> + <graphic fileref="images/architecture2.jpg"/> + </para> + <para><xref linkend="appserver-integration"/>对å¦ä½ä½¿ç¨JCAç»åºäºæ´å 详ç»çæè¿°ã</para> + </section> + <section> + <title>HornetQä½ä¸ºç¬ç«çæå¡ï¼standaloneï¼</title> + <para>HornetQå¯ä»¥é¨ç½²æ为ç¬ç«çæå¡å¨ãå®å¯è¿è¡äºä»»ä½JEEåºç¨æå¡å¨ä¹å¤ï¼ä½ä¸ºä¸ä¸ªç¬ç«çæå¡è¿è¡ã + ä½ä¸ºç¬ç«æå¡å¨è¿è¡æ¶ï¼HornetQæ¶æ¯æå¡å¨å æ¬ä¸ä¸ªæ ¸å¿æå¡å¨ï¼ä¸ä¸ªJMSæå¡ä»¥åä¸ä¸ªJNDIæå¡ã</para> + <para>JMSæå¡ç¨æ¥é¨ç½²æå¡å¨ç«¯<literal>hornetq-jms.xml</literal>é ç½®æ件ä¸çJMS Queueï¼TopicåConnectionFactoryå®ä¾ã + æ¤å¤å®è¿æä¾ä¸ç»ç®åç管çæ¥å£ï¼éè¿è¿äºæ¥å£å¯ä»¥å建ãæ¶æ¯ï¼destroyï¼Queueï¼TopicåConnectionFactoryå®ä¾ã + ç¨äºå¯ä»¥éè¿JMXæè¿æ¥ä½¿ç¨è¿äºæ¥å£ãJMSæå¡æ¯åç¬çæå¡ï¼å®ä¸æ¯HornetQæ ¸å¿æå¡ãHornetQçæ ¸å¿ä¸å å«JMSç¸å ³çæå¡ã + å¦æä½ ä¸éè¦éè¿æå¡å¨ç«¯çxmlé ç½®æ件é¨ç½²ä»»ä½JMS对象ï¼ä¹ä¸éè¦JMSç管çæ¥å£ï¼ä½ å¯ä»¥éæ©ä¸å¯å¨è¯¥æå¡ã</para> + <para>å¯å¨JNDIæå¡çç®çæ¯å 为JMSéè¦éè¿JNDIæ¥è·å¾Queueï¼Topic以åConnectionFactoryãå¦æä¸éè¦ï¼ä¹å¯ä»¥éæ©ä¸å¯å¨è¯¥æå¡ã</para> + <para>HornetQå 许å¨å®¢æ·ç«¯ç¨åºä¸éè¿ç¼ç¨æ¥ç´æ¥å建åç§JMS对象åæ ¸å¿å¯¹è±¡æ¥ä»£æ¿JNDIæ¥æ¾ï¼æ以JNDIä¸æ¯å¿ éçã + HornetQéç¨JBoss Microcontaineræ¥å¼å¯¼å¹¶å®ä¾åæå¡ï¼å¹¶ä¿è¯æ¨¡åä¹é´çä¾èµå ³ç³»ãJBoss Microcontaineræ¯ä¸ä¸ªè½»é级çPOJOå¼å¯¼å¨ï¼bootstrapperï¼ã</para> + <para>å¾3.3ç»åºäºHornetQç¬ç«æå¡å¨çæ¶æã</para> + <para> + <graphic fileref="images/architecture3.jpg"/> + </para> + <para>ç¸å ³é ç½®çç¸å ³ä¿¡æ¯å¯ä»¥å¨ç¬¬<xref + linkend="server.configuration"/>æ¾å°ã$ </para> + </section> +</chapter>