[jboss-svn-commits] JBL Code SVN: r25291 - in labs/jbossesb/branches/JBESB_4_4_GA_FP/product: rosetta/src/org/jboss/soa/esb/client and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Feb 16 20:39:20 EST 2009


Author: beve
Date: 2009-02-16 20:39:20 -0500 (Mon, 16 Feb 2009)
New Revision: 25291

Modified:
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/docs/ProgrammersGuide.odt
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
   labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/services/persistence/RedeliverStore.java
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2406 "Allow configuration of async redelivery property on a per message basis"


Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/docs/ProgrammersGuide.odt
===================================================================
(Binary files differ)

Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java	2009-02-17 00:41:48 UTC (rev 25290)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/client/ServiceInvoker.java	2009-02-17 01:39:20 UTC (rev 25291)
@@ -190,6 +190,10 @@
      * Synchronously deliver the supplied message to the target service associated with this invoker instance.
      * If the To field of the Message is set, then it will be ignored in favour of the equivalent information
      * obtained through the parameters provided during instance construction.
+     * 
+     * Redelivery on failure can be defined by setting the global org.jboss.soa.esb.dls.redeliver property in
+     * the configuration file or by setting it on a per message basis as a message property. The message property
+     * will be used in preference to the global value.
      *
      * @param message       The message to be delivered.
      * @param timeoutMillis Number of milliseconds before synchronous reply pickup should timeout.
@@ -203,8 +207,7 @@
         try {
             message = post(message, new EPRInvoker(timeoutMillis));
         } catch (MessageDeliverException mde) {
-            if ("true".equalsIgnoreCase(Configuration.getRedeliveryDlsOn())
-                    && !service.equals(dlqService)) {
+            if (asyncRedelivery(message) && !service.equals(dlqService)) {
                 //Send a copy to the DLQ, no retries for syncDeliveries
                 message.getProperties().setProperty(DELIVER_TO, service);
 
@@ -221,6 +224,10 @@
      * Asynchronously deliver the supplied message to the target service associated with this invoker instance.
      * If the To field of the Message is set, then it will be ignored in favour of the equivalent information
      * obtained through the parameters provided during instance construction.
+     * 
+     * Redelivery on failure can be defined by setting the global org.jboss.soa.esb.dls.redeliver property in
+     * the configuration file or by setting it on a per message basis as a message property. The message property
+     * will be used in preference to the global value.
      *
      * @param message The message to be delivered.
      * @throws MessageDeliverException Failed to deliver message, after trying all available EPRs.
@@ -233,7 +240,7 @@
             post(message, new EPRInvoker());
         } catch (MessageDeliverException mde) {
             if (message.getProperties().getProperty(RedeliverStore.IS_REDELIVERY)==null
-                    && "true".equalsIgnoreCase(Configuration.getRedeliveryDlsOn())
+                    && asyncRedelivery(message)
                     && !service.equals(dlqService)) {
                 message.getProperties().setProperty(MessageStore.CLASSIFICATION, MessageStore.CLASSIFICATION_RDLVR);
                 message.getProperties().setProperty(DELIVER_TO, service);
@@ -489,7 +496,25 @@
         serviceClusterInfo = new ServiceClusterInfoImpl(service.getName(), serviceEprs);
         expirationDate = new Date(java.lang.System.currentTimeMillis() + registryCacheLife);
     }
-
+    
+    /*
+     * Is redelivery overridden on a per message basis? If not, use the global setting.
+     */
+    
+    private boolean asyncRedelivery (final Message message)
+    {
+        Object perMessage = message.getProperties().getProperty(Environment.REDELIVER_DLS_SERVICE_ON);
+        
+        if (perMessage == null) // user does not care so use the global property
+            return "true".equalsIgnoreCase(Configuration.getRedeliveryDlsOn());
+        else
+        {
+            // use whatever is set on the message in preference to global value
+            
+            return "true".equalsIgnoreCase((String) perMessage);
+        }
+    }
+    
     private class EPRInvoker {
 
         private boolean synchronous = false;

Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/services/persistence/RedeliverStore.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/services/persistence/RedeliverStore.java	2009-02-17 00:41:48 UTC (rev 25290)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/services/persistence/RedeliverStore.java	2009-02-17 01:39:20 UTC (rev 25291)
@@ -1,6 +1,25 @@
-/**
- * 
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
+
 package org.jboss.soa.esb.services.persistence;
 
 import java.net.URI;




More information about the jboss-svn-commits mailing list