camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markwolfe <mrwo...@gmail.com>
Subject RedeliveryPolicy semantics
Date Wed, 02 Jan 2008 23:30:24 GMT

Gday

Currently having a look at camel to receive, transform, and validate some
files prior to uploading to a existing system.

The idea is a system uploads binary data files to a directory which camel
will consume. These files never expire and need to moved through a pipeline
will transform them, do some validation and then transport them to a retro
system using FTP. So far Camel has done an excellent job of doing this. 

However I have run into an interesting dilemma relating to the current
redelivery policy. When we started testing the idea network outages showed
up an interesting issue. As far as I can see it only supports a retry count
being set that defines a count of tries and a couple back off strategies. In
my case however I would like it to try to retransmit until it is delivered.
To test this I have made a small change in the code.

==== START PATCH ====
Index:
camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java
===================================================================
---
camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java  
(revision 608236)
+++
camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java  
(working copy)
@@ -30,6 +30,9 @@
  * @version $Revision$
  */
 public class RedeliveryPolicy implements Cloneable, Serializable {
+
+       public static int UNLIMITED_REDELIVERIES = -1;
+
     protected static transient Random randomNumberGenerator;
     protected int maximumRedeliveries = 6;
     protected long initialRedeliveryDelay = 1000L;
@@ -60,7 +63,14 @@
      * redelivered
      */
     public boolean shouldRedeliver(int redeliveryCounter) {
-        return redeliveryCounter < getMaximumRedeliveries();
+    
+       // infinite retries is represented by UNLIMITED_REDELIVERIES
+       if (getMaximumRedeliveries() == UNLIMITED_REDELIVERIES){
+               return true;
+       } else {
+            return redeliveryCounter < getMaximumRedeliveries();
+       }
+    
     }
 
     // Builder methods
==== END PATCH ====

Currently this is quite a simple hack. If people see the value of this
change I would be happy to build a couple of tests and add it to Jira.

Regards

Mark Wolfe
-- 
View this message in context: http://www.nabble.com/RedeliveryPolicy-semantics-tp14588327s22882p14588327.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message