[jboss-svn-commits] JBL Code SVN: r20133 - in labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted: src/org/jboss/soa/esb/samples/quickstart/jmstransacted/test and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri May 23 10:09:02 EDT 2008
Author: kevin.conner at jboss.com
Date: 2008-05-23 10:09:02 -0400 (Fri, 23 May 2008)
New Revision: 20133
Added:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/src/org/jboss/soa/esb/samples/quickstart/jmstransacted/test/ThrowExceptionAction.java
Removed:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/src/org/jboss/soa/esb/samples/quickstart/jmstransacted/test/RollbackTransactionAction.java
Modified:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/jboss-esb.xml
Log:
revert back to throwing the exception: JBESB-1766
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/jboss-esb.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/jboss-esb.xml 2008-05-23 14:07:19 UTC (rev 20132)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/jboss-esb.xml 2008-05-23 14:09:02 UTC (rev 20133)
@@ -48,7 +48,11 @@
<property name="db-insert-sql" value="insert into jms_transacted_table(data_column) values(?)"/>
</action>
- <action name="rollbackTransaction" class="org.jboss.soa.esb.samples.quickstart.jmstransacted.test.RollbackTransactionAction"/>
+ <!--
+ Will throw an Exception upon every other first. This should trigger the transaction to be
+ rolledback and the message placed back onto the JMS queue.
+ -->
+ <action name="throwExceptionAction" class="org.jboss.soa.esb.samples.quickstart.jmstransacted.test.ThrowExceptionAction"/>
<action name="printMessageDone" class="org.jboss.soa.esb.actions.SystemPrintln">
<property name="message" value="JMS Transacted Quickstart processed sucessfully. Message body"/>
Deleted: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/src/org/jboss/soa/esb/samples/quickstart/jmstransacted/test/RollbackTransactionAction.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/src/org/jboss/soa/esb/samples/quickstart/jmstransacted/test/RollbackTransactionAction.java 2008-05-23 14:07:19 UTC (rev 20132)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/src/org/jboss/soa/esb/samples/quickstart/jmstransacted/test/RollbackTransactionAction.java 2008-05-23 14:09:02 UTC (rev 20133)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-package org.jboss.soa.esb.samples.quickstart.jmstransacted.test;
-
-import static org.jboss.soa.esb.notification.jms.JMSPropertiesSetter.JMS_REDELIVERED;
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.actions.ActionLifecycle;
-import org.jboss.soa.esb.actions.ActionLifecycleException;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.common.TransactionStrategy;
-import org.jboss.soa.esb.common.TransactionStrategyException;
-
-/**
- * RollbackTransactionAction is a simple action that rolls back the <br>
- * the current transaction if the rollback field is true.
- * </p>
- * Note that this class in only intended to be used with the
- * jms_transacted quickstart.
- * </p>
- * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>
- *
- */
-public class RollbackTransactionAction implements ActionLifecycle
-{
- private Logger log = Logger .getLogger( RollbackTransactionAction.class );
-
- public RollbackTransactionAction( final ConfigTree config )
- {
- }
-
- /**
- * Will rollback the the current transaction if the rollback
- * the JMS_REDELIVERED) property is false. Else this is a NOOP and
- * simple passes the message through.
- *
- * @param message - ESB Message object
- * @return Message - ESB Message Object
- * @throws TransactionStrategyException
- */
- public Message process( Message message ) throws TransactionStrategyException
- {
- final Boolean redelivered = (Boolean) message.getProperties().getProperty( JMS_REDELIVERED );
- log.info("[" +JMS_REDELIVERED + ":" + redelivered + "]" );
-
- if ( redelivered )
- {
- return message;
- }
- else
- {
- TransactionStrategy strategy = TransactionStrategy.getTransactionStrategy(true);
- log.info( "Setting transaction to rollback only" );
- strategy.rollbackOnly();
- message = null;
- }
- return message;
- }
-
- public void processException(final Message message, final Throwable th) { }
- public void destroy() throws ActionLifecycleException {}
- public void initialise() throws ActionLifecycleException {}
-
-}
Copied: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/src/org/jboss/soa/esb/samples/quickstart/jmstransacted/test/ThrowExceptionAction.java (from rev 20020, labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/src/org/jboss/soa/esb/samples/quickstart/jmstransacted/test/ThrowExceptionAction.java)
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/src/org/jboss/soa/esb/samples/quickstart/jmstransacted/test/ThrowExceptionAction.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/jms_transacted/src/org/jboss/soa/esb/samples/quickstart/jmstransacted/test/ThrowExceptionAction.java 2008-05-23 14:09:02 UTC (rev 20133)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.jmstransacted.test;
+
+import static org.jboss.soa.esb.notification.jms.JMSPropertiesSetter.JMS_REDELIVERED;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.actions.ActionLifecycle;
+import org.jboss.soa.esb.actions.ActionLifecycleException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * ThrowExceptionAction is a simple action that throws an exception <br>
+ * if the message has not been redelivered (first call to this action).
+ * </p>
+ * Note that this class in only intended to be used with the
+ * jms_transacted quickstart.
+ * </p>
+ * @author <a href="mailto:daniel.bevenius at gmail.com">Daniel Bevenius</a>
+ *
+ */
+public class ThrowExceptionAction implements ActionLifecycle
+{
+ private Logger log = Logger .getLogger( ThrowExceptionAction.class );
+
+ public ThrowExceptionAction( final ConfigTree config ) { }
+
+ /**
+ * Checks if the ESB Messae property 'javax.jms.message.redelivered'
+ * is false, in which case an IllegalArgumentException will be thrown. <br>
+ * This will will cause the message to be redelivered by JMS transaction
+ * handling.
+ *
+ * @param message - ESB Message object
+ * @return Message - unchanged ESB Message Object
+ */
+ public Message process( final Message message )
+ {
+ final Boolean redelivered = (Boolean) message.getProperties().getProperty( JMS_REDELIVERED );
+ log.info("[" +JMS_REDELIVERED + ":" + redelivered + "]" );
+
+ if ( redelivered )
+ return message;
+ else
+ throw new IllegalStateException( "[Throwing Exception to trigger a transaction rollback]");
+ }
+
+ public void processException(final Message message, final Throwable th) { }
+ public void destroy() throws ActionLifecycleException {}
+ public void initialise() throws ActionLifecycleException {}
+
+}
More information about the jboss-svn-commits
mailing list