On 02/01/2008, markwolfe <[EMAIL PROTECTED]> wrote:
>
> 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.

Great, thanks!


> 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.

Great idea! We definitely should support continuous retries.

I've gone ahead and applied your patch so that a negative value of
maximumRedeliveries means retry forever (then 0 means never retry).
Many thanks!

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Reply via email to