servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccust...@apache.org
Subject svn commit: r784020 - in /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src: main/java/org/apache/servicemix/jms/endpoints/ test/java/org/apache/servicemix/jms/
Date Fri, 12 Jun 2009 07:54:57 GMT
Author: ccustine
Date: Fri Jun 12 07:54:56 2009
New Revision: 784020

URL: http://svn.apache.org/viewvc?rev=784020&view=rev
Log:
SMXCOMP-565 - JMS consumer marshaler rollBackOnError flag is overwritten

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/JmsConsumerEndpoint.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/test/java/org/apache/servicemix/jms/JmsProviderConsumerEndpointTest.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=784020&r1=784019&r2=784020&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
Fri Jun 12 07:54:56 2009
@@ -54,6 +54,8 @@
 
     private URI mep;
     private boolean rollbackOnError;
+    private boolean rollbackOnErrorDefault;
+    private boolean rollbackConfigured;
 
     public DefaultConsumerMarshaler() {
         this.mep = MessageExchangeSupport.IN_ONLY;
@@ -78,16 +80,29 @@
     }
 
     public boolean isRollbackOnError() {
-        return rollbackOnError;
+        return rollbackConfigured ? rollbackOnError : rollbackOnErrorDefault;
     }
 
     /**
      * @param rollbackOnError if exchange in errors should cause a rollback on the JMS side
      */
     public void setRollbackOnError(boolean rollbackOnError) {
+        rollbackConfigured = true;
         this.rollbackOnError = rollbackOnError;
     }
 
+    /**
+     * This is called to set intelligent defaults if no
+     * explicit rollbackOnError configuration is set.
+     * If setRollbackOnError is explicitly set, it
+     * will be used.
+     *
+     * @param rollbackDefault default rollbackOnError setting
+     */
+    public void setRollbackOnErrorDefault(boolean rollbackDefault) {
+        this.rollbackOnErrorDefault = rollbackDefault;
+    }
+    
     public JmsContext createContext(Message message) throws Exception {
         return new Context(message);
     }

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/JmsConsumerEndpoint.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/JmsConsumerEndpoint.java?rev=784020&r1=784019&r2=784020&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/JmsConsumerEndpoint.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/main/java/org/apache/servicemix/jms/endpoints/JmsConsumerEndpoint.java
Fri Jun 12 07:54:56 2009
@@ -473,7 +473,7 @@
         if (TRANSACTED_XA.equals(transacted) || TRANSACTED_JMS.equals(transacted)) {
             JmsConsumerMarshaler marshaler = getMarshaler();
             if (marshaler instanceof DefaultConsumerMarshaler) {
-                ((DefaultConsumerMarshaler)marshaler).setRollbackOnError(true);
+                ((DefaultConsumerMarshaler)marshaler).setRollbackOnErrorDefault(true);
             }
         }
     }

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/test/java/org/apache/servicemix/jms/JmsProviderConsumerEndpointTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/test/java/org/apache/servicemix/jms/JmsProviderConsumerEndpointTest.java?rev=784020&r1=784019&r2=784020&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/test/java/org/apache/servicemix/jms/JmsProviderConsumerEndpointTest.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-jms/src/test/java/org/apache/servicemix/jms/JmsProviderConsumerEndpointTest.java
Fri Jun 12 07:54:56 2009
@@ -132,7 +132,7 @@
         template.receive("destination");
 
         JmsComponent jmsComponent = new JmsComponent();
-        JmsConsumerEndpoint consumerEndpoint = createInOnlyConsumerEndpoint(connFactory);
+        JmsConsumerEndpoint consumerEndpoint = createInOnlyConsumerEndpointWithConfiguredRollback(connFactory,
true);
         consumerEndpoint.setTransacted("jms");
         JmsProviderEndpoint providerEndpoint = createProviderEndpoint(connFactory);
         jmsComponent.setEndpoints(new JmsEndpointType[] {consumerEndpoint, providerEndpoint});
@@ -267,6 +267,25 @@
         return endpoint;
     }
 
+    private JmsConsumerEndpoint createInOnlyConsumerEndpointWithConfiguredRollback(ConnectionFactory
connFactory,
+                                                                                   boolean
rollbackOnError) throws URISyntaxException {
+        JmsConsumerEndpoint endpoint = new JmsConsumerEndpoint();
+        endpoint.setService(new QName("http://jms.servicemix.org/Test", "Consumer"));
+        endpoint.setEndpoint("endpoint");
+        DefaultConsumerMarshaler marshaler = new DefaultConsumerMarshaler();
+        marshaler.setMep(new URI("http://www.w3.org/2004/08/wsdl/in-only"));
+        marshaler.setRollbackOnError(rollbackOnError);
+        endpoint.setMarshaler(marshaler);
+        endpoint.setListenerType("simple");
+        endpoint.setListenerType("simple");
+        endpoint.setConnectionFactory(connFactory);
+        endpoint.setDestinationName("destination");
+        endpoint.setRecoveryInterval(10000);
+        endpoint.setConcurrentConsumers(1);
+        endpoint.setTargetService(new QName("http://jms.servicemix.org/Test", "Echo"));
+        return endpoint;
+    }
+
     private JmsConsumerEndpoint createConsumerEndpoint(ConnectionFactory connFactory) throws
URISyntaxException {
         JmsConsumerEndpoint endpoint = new JmsConsumerEndpoint();
         endpoint.setService(new QName("http://jms.servicemix.org/Test", "Consumer"));



Mime
View raw message