[jboss-cvs] JBoss Messaging SVN: r7954 - projects/eap-docs/tags/JBoss_Messaging_User_Guide_EAP_5_0_1/HornetQ/HornetQ_User_Guide/en-US.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 22 02:57:22 EST 2010


Author: laubai
Date: 2010-02-22 02:57:21 -0500 (Mon, 22 Feb 2010)
New Revision: 7954

Modified:
   projects/eap-docs/tags/JBoss_Messaging_User_Guide_EAP_5_0_1/HornetQ/HornetQ_User_Guide/en-US/AS_Integration.xml
Log:
Partially edited AS-Integration.

Modified: projects/eap-docs/tags/JBoss_Messaging_User_Guide_EAP_5_0_1/HornetQ/HornetQ_User_Guide/en-US/AS_Integration.xml
===================================================================
--- projects/eap-docs/tags/JBoss_Messaging_User_Guide_EAP_5_0_1/HornetQ/HornetQ_User_Guide/en-US/AS_Integration.xml	2010-02-22 07:26:12 UTC (rev 7953)
+++ projects/eap-docs/tags/JBoss_Messaging_User_Guide_EAP_5_0_1/HornetQ/HornetQ_User_Guide/en-US/AS_Integration.xml	2010-02-22 07:57:21 UTC (rev 7954)
@@ -22,133 +22,126 @@
             consume messages using an InVM connector from the instance of JBoss Messaging running
             within the application server. A full list of what is configurable is found later in
             this chapter.</para>
-        <para>All MDB's however need to have the destination type and the destination configured.
+        <para>All MDBs must be configured with a destination and a destination type.
             The following example shows how this can be done via annotations.</para>
         <programlisting>@MessageDriven(name = "MDBExample",
   activationConfig = {
     @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
     @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue")
   })
-public class MDBExample implements MessageListener
-{
-   public void onMessage(Message message)...
+public class MDBExample implements MessageListener {
+  public void onMessage(Message message)...
 }</programlisting>
-        <para>In this example you can see that the MDB will consume messages from a queue that is
-            mapped into JNDI with the binding <literal>queue/testQueue</literal>. This queue must be
-            preconfigured in the usual way using the JBoss Messaging configuration files.</para>
+        <para>This example configuration shows that the MDB will consume messages from a queue that is mapped
+            into JNDI with the binding <literal>queue/testQueue</literal>. This queue must be preconfigured
+            via the JBoss Messaging configuration files.</para>
+
         <section>
-            <title>Using Container Managed Transactions</title>
-            <para>When an MDB is using Container Managed Transactions, the delivery of the message
+            <title>Using container-managed transactions</title>
+            <para>When an MDB is using container-managed transactions, message delivery
                 is done within the scope of an XA transaction. The commit or rollback of this
-                transaction is controlled by the container itself. If the transaction is rolled back
-                then the JBoss Message delivery semantics will kick in (by default this is to try
-                and redeliver the message up to 10 times before sending to a DLQ). Using annotations
+                transaction is controlled by the container itself. If the transaction is rolled back,
+                JBoss Messaging delivery semantics apply. (By default, JBoss Messaging will attempt 
+                redelivery up to ten times before sending the message to a DLQ.) Using annotations
                 this would be configured as follows:</para>
             <programlisting>@MessageDriven(name = "MDB_CMP_TxRequiredExample",
-               activationConfig =
-                     {
-                        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
-                        @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue")
-                     })
- at TransactionManagement(value= TransactionManagementType.CONTAINER)
- at TransactionAttribute(value= TransactionAttributeType.REQUIRED)
+  activationConfig = {
+    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+    @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue")
+  })
+ at TransactionManagement(value = TransactionManagementType.CONTAINER)
+ at TransactionAttribute(value = TransactionAttributeType.REQUIRED)
 public class MDB_CMP_TxRequiredExample implements MessageListener
 {
-   public void onMessage(Message message)...
+  public void onMessage(Message message)...
 }</programlisting>
             <para>The <literal>TransactionManagement</literal> annotation tells the container to
-                treat this MDB to use Container Managed Persistence. The <literal
-                    >TransactionAttribute</literal> annotation tells the container that an XA
+                treat this MDB to use Container Managed Persistence. The <literal>TransactionAttribute</literal> 
+                annotation tells the container that an XA
                 transaction is required for this MDB. Note that the only other valid value for this
                 is <literal>TransactionAttributeType.NOT_SUPPORTED</literal> which tells the
                 container that this MDB does not support XA transactions and one should not be
                 created.</para>
             <para>It is also possible to inform the container that it must rollback the transaction
-                by calling <literal>setRollbackOnly</literal> on the <literal
-                    >MessageDrivenContext</literal>. The code for this would look something
-                like:</para>
-            <programlisting>   @Resource
-   MessageDrivenContext ctx;
+                by calling <literal>setRollbackOnly</literal> on the <literal>MessageDrivenContext</literal>. 
+                The code for this would look something like:</para>
+            <programlisting>@Resource
+  MessageDrivenContext ctx;
 
-   public void onMessage(Message message)
-   {
-      try
-      {
-         //something here fails
-      }
-      catch (Exception e)
-      {
-         ctx.setRollbackOnly();
-      }
-   }</programlisting>
-            <para>If you don't want the over head of an xa transaction being created every time but
-                you would still like the message delivered within a transaction (i.e. you are only
+  public void onMessage(Message message)
+  {
+    try
+    {
+       //something here fails
+    }
+    catch (Exception e)
+    {
+       ctx.setRollbackOnly();
+    }
+  }</programlisting>
+            <para>If you don't want the overhead of an XA transaction being created every time but
+                you would still like the message delivered within a transaction (that is, you are only
                 using a JMS resource) then you can configure the MDB to use a local transaction.
-                This would be configured as such:</para>
+                This would be configured like so:</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")
-                     })
+  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)
-public class MDB_CMP_TxLocalExample implements MessageListener
-{
-   public void onMessage(Message message)...
+public class MDB_CMP_TxLocalExample implements MessageListener {
+ public void onMessage(Message message)...
 }</programlisting>
         </section>
         <section>
-            <title>Using Bean Managed Transactions</title>
-            <para>Message driven beans can also be configured to use Bean Managed Transactions. In
+            <title>Using bean-managed transactions</title>
+            <para>Message-driven beans can also be configured to use bean-managed transactions. In
                 this case a User Transaction is created. This would be configured as follows:</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")
-                     })
+  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)
-public class MDB_BMPExample implements MessageListener
-{
-   public void onMessage(Message message)
+public class MDB_BMPExample implements MessageListener {
+  public void onMessage(Message message)
 }</programlisting>
-            <para>When using Bean Managed transactions the message will be acknowledged outside the
+            <para>When using bean-managed transactions the message will be acknowledged outside the
                 scope of the user transaction and use the acknowledge mode specified by the user
-                with the <literal>acknowledgeMode</literal> property. There are only 2 acceptable
-                values for this <literal>Auto-acknowledge</literal> and <literal
-                    >Dups-ok-acknowledge</literal>.Not that because the message delivery is outside
-                the scope of the transaction a failure within the MDB will not cause the message to
-                be redelivered.</para>
-            <para>A user would control the lifecycle of the transaction something like the
-                following:</para>
-            <programlisting>   @Resource
-   MessageDrivenContext ctx;
+                with the <varname>acknowledgeMode</varname> property. <varname>acknowledgeMode</varname> has
+                two valid values: <literal>Auto-acknowledge</literal> and <literal>Dups-ok-acknowledge</literal>.
+                Note that because message delivery is outside the scope of the transaction, a failure within the 
+                MDB will not cause the message to be redelivered.</para>
+            <para>A user would control the lifecycle of the transaction as follows:</para>
+            <programlisting>@Resource
+  MessageDrivenContext ctx;
 
-   public void onMessage(Message message)
-   {
-      UserTransaction tx;
-      try
-      {
-         TextMessage textMessage = (TextMessage)message;
+  public void onMessage(Message message)
+  {
+    UserTransaction tx;
+    try
+    {
+       TextMessage textMessage = (TextMessage)message;
 
-         String text = textMessage.getText();
+       String text = textMessage.getText();
 
-         UserTransaction tx = ctx.getUserTransaction();
+       UserTransaction tx = ctx.getUserTransaction();
 
-         tx.begin();
-         //do some stuff within the transaction
-         tx.xommit();
+       tx.begin();
+       //do some stuff within the transaction
+       tx.xommit();
 
-      }
-      catch (Exception e)
-      {
-         tx.rollback();
-      }
-   }</programlisting>
+    }
+    catch (Exception e)
+    {
+       tx.rollback();
+    }
+  }</programlisting>
         </section>
+<!--hajime-->
         <section>
             <title>Using Message Selectors with MDB's</title>
             <para>It is also possible to use MDB's with message selectors. To do this simple define




More information about the jboss-cvs-commits mailing list