servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r752101 - in /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints: DefaultConsumerMarshaler.java JmsSoapConsumerMarshaler.java
Date Tue, 10 Mar 2009 12:57:22 GMT
Author: gnodet
Date: Tue Mar 10 12:57:22 2009
New Revision: 752101

URL: http://svn.apache.org/viewvc?rev=752101&view=rev
Log:
SMXCOMP-474: Regression introduced in servicemix-jms default consumer which does not rollback
the transactions by default when an exchange with an ERROR status comes back

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/DefaultConsumerMarshaler.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/JmsSoapConsumerMarshaler.java

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/DefaultConsumerMarshaler.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/DefaultConsumerMarshaler.java?rev=752101&r1=752100&r2=752101&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/DefaultConsumerMarshaler.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/DefaultConsumerMarshaler.java
Tue Mar 10 12:57:22 2009
@@ -53,6 +53,7 @@
 public class DefaultConsumerMarshaler extends AbstractJmsMarshaler implements JmsConsumerMarshaler
{
 
     private URI mep;
+    private boolean rollbackOnError;
 
     public DefaultConsumerMarshaler() {
         this.mep = MessageExchangeSupport.IN_ONLY;
@@ -76,6 +77,17 @@
         this.mep = mep;
     }
 
+    public boolean isRollbackOnError() {
+        return rollbackOnError;
+    }
+
+    /**
+     * @param rollbackOnError if exchange in errors should cause a rollback on the JMS side
+     */
+    public void setRollbackOnError(boolean rollbackOnError) {
+        this.rollbackOnError = rollbackOnError;
+    }
+
     public JmsContext createContext(Message message) throws Exception {
         return new Context(message);
     }
@@ -146,9 +158,13 @@
 
     public Message createError(MessageExchange exchange, Exception error, 
                                Session session, JmsContext context) throws Exception {
-        ObjectMessage message = session.createObjectMessage(error);
-        message.setBooleanProperty(ERROR_JMS_PROPERTY, true);
-        return message;
+        if (rollbackOnError) {
+            throw error;
+        } else {
+            ObjectMessage message = session.createObjectMessage(error);
+            message.setBooleanProperty(ERROR_JMS_PROPERTY, true);
+            return message;
+        }
     }
 
     protected void populateMessage(Message message, NormalizedMessage normalizedMessage)
throws Exception {

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/JmsSoapConsumerMarshaler.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/JmsSoapConsumerMarshaler.java?rev=752101&r1=752100&r2=752101&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/JmsSoapConsumerMarshaler.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/JmsSoapConsumerMarshaler.java
Tue Mar 10 12:57:22 2009
@@ -44,6 +44,7 @@
     private Binding<?> binding;
     private boolean useJbiWrapper = true;
     private Policy[] policies;
+    private boolean rollbackOnError;
     
     /**
      * @return the binding
@@ -87,6 +88,17 @@
         this.useJbiWrapper = useJbiWrapper;
     }
 
+    public boolean isRollbackOnError() {
+        return rollbackOnError;
+    }
+
+    /**
+     * @param rollbackOnError if exchange in errors should cause a rollback on the JMS side
+     */
+    public void setRollbackOnError(boolean rollbackOnError) {
+        this.rollbackOnError = rollbackOnError;
+    }
+
     public JmsContext createContext(Message message) throws Exception {
         return new Context(message);
     }
@@ -135,23 +147,27 @@
     }
 
     public Message createError(MessageExchange exchange, Exception error, Session session,
JmsContext context) throws Exception {
-        org.apache.servicemix.soap.api.Message in = ((Context) context).msg;
-        org.apache.servicemix.soap.api.Message msg = binding.createMessage(in);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        msg.setContent(OutputStream.class, baos);
-        msg.setContent(MessageExchange.class, exchange);
-        msg.put(SoapVersion.class, in.get(SoapVersion.class));
-        msg.put(JbiConstants.USE_JBI_WRAPPER, useJbiWrapper);
-        InterceptorChain phase = getChain(Phase.ServerOutFault);
-        SoapFault soapFault;
-        if (error instanceof SoapFault) {
-            soapFault = (SoapFault) error;
+        if (rollbackOnError) {
+            throw error;
         } else {
-            soapFault = new SoapFault(error);
+            org.apache.servicemix.soap.api.Message in = ((Context) context).msg;
+            org.apache.servicemix.soap.api.Message msg = binding.createMessage(in);
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            msg.setContent(OutputStream.class, baos);
+            msg.setContent(MessageExchange.class, exchange);
+            msg.put(SoapVersion.class, in.get(SoapVersion.class));
+            msg.put(JbiConstants.USE_JBI_WRAPPER, useJbiWrapper);
+            InterceptorChain phase = getChain(Phase.ServerOutFault);
+            SoapFault soapFault;
+            if (error instanceof SoapFault) {
+                soapFault = (SoapFault) error;
+            } else {
+                soapFault = new SoapFault(error);
+            }
+            msg.setContent(Exception.class, soapFault);
+            phase.doIntercept(msg);
+            return session.createTextMessage(baos.toString());
         }
-        msg.setContent(Exception.class, soapFault);
-        phase.doIntercept(msg);
-        return session.createTextMessage(baos.toString());
     }
 
     protected InterceptorChain getChain(Phase phase) {



Mime
View raw message