[jboss-svn-commits] JBL Code SVN: r20010 - labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon May 19 04:14:44 EDT 2008
Author: beve
Date: 2008-05-19 04:14:44 -0400 (Mon, 19 May 2008)
New Revision: 20010
Modified:
labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/readme.txt
Log:
Work for JBESB-1664 "Add an expected output portion to jms_transacted QS"
Modified: labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/build.xml 2008-05-19 05:23:45 UTC (rev 20009)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/build.xml 2008-05-19 08:14:44 UTC (rev 20010)
@@ -27,9 +27,12 @@
<arg value="Hello Transacted JMS World]"/>
<classpath refid="exec-classpath"/>
</java>
+ <sleep milliseconds="4000"/>
+ <antcall target="select"/>
+ <antcall target="truncate"/>
</target>
- <target name="select" depends="dependencies" description="select * from jsm_transacted_table">
+ <target name="select">
<property name="hsqldb.jar"
value="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}/lib/hsqldb.jar"/>
<echo>Select * from jms_transacted_table</echo>
@@ -50,10 +53,10 @@
</target>
- <target name="truncate" depends="dependencies" description="delete from jms_transacted_table">
+ <target name="truncate">
<property name="hsqldb.jar"
value="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}/lib/hsqldb.jar"/>
- <echo>Delete from jms_transacted_table </echo>
+ <echo>(clean up) Delete from jms_transacted_table </echo>
<sql
print="true"
driver="org.hsqldb.jdbcDriver"
Modified: labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/jboss-esb.xml 2008-05-19 05:23:45 UTC (rev 20009)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/jboss-esb.xml 2008-05-19 08:14:44 UTC (rev 20010)
@@ -1,52 +1,51 @@
<?xml version = "1.0" encoding = "UTF-8"?>
<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
- <providers>
- <jms-jca-provider name="JBossMessaging" connection-factory="XAConnectionFactory"
- jndi-URL="jnp://127.0.0.1:1099" jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
- jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces">
-
- <jms-bus busid="quickstartGwChannel">
- <jms-message-filter
- dest-type="QUEUE"
- dest-name="queue/quickstart_jms_transacted_Request_gw"
- transacted="true"
- />
- </jms-bus>
- <jms-bus busid="quickstartEsbChannel">
- <jms-message-filter
- dest-type="QUEUE"
- dest-name="queue/quickstart_jms_transacted_Request_esb"
- transacted="true"
- />
- </jms-bus>
- <activation-config>
- <!-- The maximum number of times a message is redelivered before it is sent to the DLQ -->
- <property name="dLQMaxResent" value="5"/>
- </activation-config>
+ <providers>
+ <jms-jca-provider name="JBossMessaging" connection-factory="XAConnectionFactory"
+ jndi-URL="jnp://127.0.0.1:1099" jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces">
- </jms-jca-provider>
- </providers>
-
- <services>
- <service
- category="JMSSecuredESB"
- name="SimpleListener"
- description="JMS Secured quickstart sample">
- <listeners>
- <jms-listener name="JMS-Gateway"
- busidref="quickstartGwChannel"
- maxThreads="1"
- is-gateway="true"
- />
- <jms-listener name="jmssecured"
- busidref="quickstartEsbChannel"
- maxThreads="1"/>
- </listeners>
- <actions mep="OneWay">
-
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_jms_transacted_Request_gw"
+ transacted="true"
+ />
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_jms_transacted_Request_esb"
+ transacted="true"
+ />
+ </jms-bus>
+ <activation-config>
+ <!-- The maximum number of times a message is redelivered before it is sent to the DLQ -->
+ <property name="dLQMaxResent" value="5"/>
+ </activation-config>
+
+ </jms-jca-provider>
+ </providers>
+
+ <services>
+ <service
+ category="JMSSecuredESB"
+ name="SimpleListener"
+ description="JMS Secured quickstart sample">
+ <listeners>
+ <jms-listener name="JMS-Gateway"
+ busidref="quickstartGwChannel"
+ maxThreads="1"
+ is-gateway="true"/>
+ <jms-listener name="jmssecured"
+ busidref="quickstartEsbChannel"
+ maxThreads="1"/>
+ </listeners>
+ <actions mep="OneWay">
+
<action name="printMessage" class="org.jboss.soa.esb.actions.SystemPrintln">
- <property name="message" value="JMS Transacted Quickstart start..."/>
+ <property name="message" value="JMS Transacted Quickstart entered. Message body"/>
<property name="printfull" value="false"/>
</action>
@@ -54,22 +53,22 @@
<property name="datasource-name" value="java:QuickstartDS"/>
<property name="db-insert-sql" value="insert into jms_transacted_table(data_column) values(?)"/>
</action>
-
- <!-- Rollback the current transaction -->
+
+ <!-- Rollback the current transaction -->
<action name="rollbackTransaction" class="org.jboss.soa.esb.samples.quickstart.jmstransacted.test.RollbackTransactionAction">
<property name="rollback" value="true"/> <!-- optional as default is true -->
<property name="nr-of-rollbacks" value="5"/> <!-- should match dLQMaxResent -->
</action>
-
+
<action name="printMessageDone" class="org.jboss.soa.esb.actions.SystemPrintln">
- <property name="message" value="JMS Transacted Quickstart processed sucessfully"/>
+ <property name="message" value="JMS Transacted Quickstart processed successfully. Message body"/>
<property name="printfull" value="false"/>
</action>
-
+
<!-- The next action is for Continuous Integration testing -->
<action name="testStore" class="org.jboss.soa.esb.actions.StoreMessageToFile"/>
- </actions>
- </service>
- </services>
+ </actions>
+ </service>
+ </services>
</jbossesb>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/readme.txt 2008-05-19 05:23:45 UTC (rev 20009)
+++ labs/jbossesb/trunk/product/samples/quickstarts/jms_transacted/readme.txt 2008-05-19 08:14:44 UTC (rev 20010)
@@ -4,22 +4,8 @@
in the ESB can be configured to use transactions and how redelivery can be
accomplished by taking advantage of the JMS transport.
- This quickstart consists of a single service that contains 4 actions:
- 1. Log a statement that we have entered the quickstart.
- 2. Insert the contents of the ESB Message object to a database table
- 3. Call a custom action that rolls back the current transaction
- 4. Log a statement that we are about to exit the quickstart.
+ For details about this quickstart see the 'What to look for in this Quickstart" section.
- The main thing to look for is that the first time we enter the action processing
- pipleline, we insert a row into the database, but since the commit is not done
- until the whole pipeline has been executed (as we are using the jms-jca-provider)
- the commit for this insert is not performed. The same goes for the message
- acknowledement of the JMS Message, which in turn causes the JMS message to be
- put back onto the queue.
-
- For more details about how this quickstart works look at the
- "What to look at in this Quckstart" section below.
-
This quickstart uses jms-jca-provider and more information about jms jca can
be found here: http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingJCAWithJBossESB
@@ -31,66 +17,76 @@
To Run '.esb' archive mode:
===========================
1. In a command terminal window in this folder ("Window1"), type:
- 'ant deploy'
- This will deploy the quickstart
- 2. type:
+ 'ant deploy'
+ This will deploy the quickstart
+ 2. Run the quickstart:
'ant runtest'
3. Switch back to Application Server console to see the output from the ESB
- 4. In this folder ("Window1"), type:
- 'ant select'
- This will display the content of the database table
- 5. [optional] In this folder ("Window1"), type:
- 'ant truncate'
- This will delete the content of the database table.
- 6. In this folder ("Window1"), type:
- 'ant undeploy'
- This will undeploy the quickstart.
+ 4. Undeploy the quickstart:
+ 'ant undeploy'
-What to look at in this Quickstart:
+What to look for in this Quickstart:
===================================
- 1. DBInsertAction
- Inserts the contents of the ESB Message object into the database table
- by using the sql statement defined in the property 'db-insert-sql'.
- This class contains a counter that is incremented for each call. This
- counter is added to the text inserted into the table. The string looks
- like this:
- [Hello Transacted JMS World] counter[1]] // counter == 1;
- This is done to seperate the inserts and visually verify that the correct
- data is committed to the database. In a normal run, when the counter is
- '1', the counter should be 2 indicating that only the second commit succeeded.
+
+ 1. Overall flow of this quickstart:
+ * The first time we enter the action pipleline, we insert a row into the database: (server console output below)
+ [DBInsertAction] Successfully inserted [Hello Transacted JMS World] counter[1]] into jms_transacted_table
+
+ * Next, the RollbackTransationAction is called.
+ This action can be configured with the number of times the action should rollback the transaction (jboss-esb.xml):
+ <property name="nr-of-rollbacks" value="5"/>
+
+ The default configuration will cause the transaction to be rolled back 5 times: (server console ouput below)
+ [RollbackTransactionAction] Setting transaction to rollback only
+
+ In the cases where the transaction is rolled back, the database insert in the preceeding action is also rolled back.
+ After 'nr-of-rollbacks' has been reached the action pipeline will complete normally: (server console ouput below)
+ [DBInsertAction] Successfully inserted [Hello Transacted JMS World] counter[5]] into jms_transacted_table
+ [STDOUT] JMS Transacted Quickstart processed sucessfully:
+
+ * Only the last insert will be committed to the database when the action pipeline successfully completes.
+ In the console output window where 'ant runtest' was run from, the output of the database table is displayed:
+ [echo] Select * from jms_transacted_table
+ [sql] Executing commands
+ [sql] DATA_COLUMN
+ [sql] Hello Transacted JMS World] counter[5]
+ [sql]
+ [sql] 0 rows affected
+ [sql] 1 of 1 SQL statements executed successfully
+ This shows that only the last insert was committed. The others were never written to the database since they were
+ rolled back.
+
+ The value of counter in 'Hello Transacted JMS World] counter[5]' should always match the value in the servers console for
+ the last successfully completed execution of the action pipeline:
+ [DBInsertAction] Successfully inserted [Hello Transacted JMS World] counter[5]] into jms_transacted_table
+ [STDOUT] JMS Transacted Quickstart processed successfully:
+ [STDOUT] [Hello Transacted JMS World]].
+
+ 2. org.jboss.soa.esb.samples.quickstart.jmstransacted.test.DBInsertAction
+ Inserts the contents of the ESB Message object into the database table by using the sql statement defined in
+ the property 'db-insert-sql'.
+ This class contains a counter that is incremented for each call. This counter is added to the text inserted into the table.
+ The string looks like this: [Hello Transacted JMS World] counter[1]]
+ This is done to seperate the inserts and visually verify that the correct data is committed to the database.
- 2. RollbackTransactionAction
- The current transaction is rolled back by the folling code in the process method:
- TransactionStrategy strategy = TransactionStrategy.getTransactionStrategy(true);
- log.info( "Setting transaction to rollback only" );
- strategy.rollbackOnly();
+ 3. org.jboss.soa.esb.samples.quickstart.jmstransacted.test.RollbackTransactionAction
+ The current transaction is rolled back by the folling code in the process method:
+ TransactionStrategy strategy = TransactionStrategy.getTransactionStrategy(true);
+ log.info( "Setting transaction to rollback only" );
+ strategy.rollbackOnly();
- 3. jboss-esb.xml
+ 4. jboss-esb.xml
The message-filter for the jms-bus-filter now specifies 'transacted' attribute.
- Notice the "dlQMaxResent" activation-config property:
- <activation-config>
- <!-- The maximum number of times a message is redelivered before it is sent to the DLQ -->
- <property name="dLQMaxResent" value="5"/>
- </activation-config>
- For activation-config properties see : http://www.jboss.org/wiki/Wiki.jsp?page=ConfigJMSMessageListener
- Note that if any of the following properites are specified the ESB will throw ConfigurationException:
- * destination
- * destinationType
- * messageSelector
- * maxMessages
+ Notice the "dlQMaxResent" activation-config property:
+ <activation-config>
+ <!-- The maximum number of times a message is redelivered before it is sent to the DLQ -->
+ <property name="dLQMaxResent" value="5"/>
+ </activation-config>
- 4. jbm-queue-service.xml
- Notice the following attributes:
- <!-- redelivery attempt delay in millis -->
- <attribute name="RedeliveryDelay">1000</attribute>
- <attribute name="MaxDeliveryAttempts">15</attribute>
- MaxDeliveryAttempts must be greater then dLQMaxReset or it will take
- priority over dLQMaxReset.
+ For activation-config properties see : http://www.jboss.org/wiki/Wiki.jsp?page=ConfigJMSMessageListener
- 5. 'ant select'
- Ant target that will display all the rows in the database table.
+ 5. jbm-queue-service.xml
+ Notice the following attribute:
+ <attribute name="MaxDeliveryAttempts">15</attribute>
+ MaxDeliveryAttempts must be greater then dLQMaxReset or it will take priority over dLQMaxReset.
- 6. 'ant truncate'
- Ant target that will delete all the rows in the database table.
- Useful to clear the table after multiple runs.
-
More information about the jboss-svn-commits
mailing list