You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pratibhaG <pr...@in2m.com> on 2008/08/13 11:57:19 UTC

camel 1.4 redelivery issue

I have following configuration:
exception(java.net.SocketException.class)
        .maximumRedeliveries(5)
        .useExponentialBackOff()
        .initialRedeliveryDelay(300000L)
        .backOffMultiplier(2.0)
        .intercept(new
CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));
          
Here the message should be redelivered first after 300000 ms and then
increase exponentially. But this works unexpected. It redelivers the message
every 60000ms. 

Is it because the new feature 
maximumRedeliveryDelay = 60 * 1000L (60 seconds, new option in Camel 1.4)

How can I change maximumRedeliveryDelay. Currently if I set
initialRedeliveryDelay(30000L), it works fine for first attempt that is when
the time is less than 60000ms. But if the value is more than 60000L it doe
not. 

how can I solve this?

please help

Pratibha
-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18960138.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Glad that you found the solution. And even more glad that Camel in fact did support the mixed configuration where you can set the maximumRedeliveryDelay on the DLC and then have custom settings per. exception.

In fact this is brilliant. But nevertheless we will add the missing method to the fluent builder so you also can do it on the exception().

Maybe we should add some in the wiki that this can be mixed/matched and inherited in Camel 1.4.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: pratibhaG [mailto:pratibha.ghogale@in2m.com] 
Sent: 14. august 2008 09:16
To: camel-user@activemq.apache.org
Subject: RE: camel 1.4 redelivery issue


I did this:
errorHandler(deadLetterChannel().maximumRedeliveryDelay(3000000L));
    	
    	exception(java.lang.Throwable.class)
        .intercept(new
CustomDelegateProcessor(ErrorConstants.SYSTEM_ERROR));                
       
        exception(java.net.SocketException.class)
		.maximumRedeliveries(5)
		.useExponentialBackOff()
		.initialRedeliveryDelay(300000)
		.backOffMultiplier(2.0)
		.intercept(new CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));

and it solved all the problems.

Prtaibha

-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18976804.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by pratibhaG <pr...@in2m.com>.
I did this:
errorHandler(deadLetterChannel().maximumRedeliveryDelay(3000000L));
    	
    	exception(java.lang.Throwable.class)
        .intercept(new
CustomDelegateProcessor(ErrorConstants.SYSTEM_ERROR));                
       
        exception(java.net.SocketException.class)
		.maximumRedeliveries(5)
		.useExponentialBackOff()
		.initialRedeliveryDelay(300000)
		.backOffMultiplier(2.0)
		.intercept(new CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));

and it solved all the problems.

Prtaibha

-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18976804.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Me again before leaving for work.

Why cant you just create a RedeliveryPolicy object using plain standard java and set it on the exception type?

RedeliveryPolicy policy = new ...
policy.setXXX
policy.setXXX
policy.setXXX


exception(MyBusinessException).setRedeliveryPolicu(policy).to(...);



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Claus Ibsen [mailto:ci@silverbullet.dk] 
Sent: 14. august 2008 07:46
To: camel-user@activemq.apache.org
Subject: RE: camel 1.4 redelivery issue

Hi

All the "magic" is done in the sleep method of org.apache.camel.procssor.RedeliveryPolicy.

You could create your own class that extends this one and handle the logic in the sleep method to avoid the 60 sec limit.

Then you could set your class as the redelivery policy on the exception type.




Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: pratibhaG [mailto:pratibha.ghogale@in2m.com] 
Sent: 14. august 2008 06:38
To: camel-user@activemq.apache.org
Subject: RE: camel 1.4 redelivery issue


Yes exception() overrides the DLC. I can not set all the options on the DLC
rather than on the exception type as I have to handle the exceptions
depending on the type.

Is there any other alternative?

Pratibha
-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18975591.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

All the "magic" is done in the sleep method of org.apache.camel.procssor.RedeliveryPolicy.

You could create your own class that extends this one and handle the logic in the sleep method to avoid the 60 sec limit.

Then you could set your class as the redelivery policy on the exception type.




Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: pratibhaG [mailto:pratibha.ghogale@in2m.com] 
Sent: 14. august 2008 06:38
To: camel-user@activemq.apache.org
Subject: RE: camel 1.4 redelivery issue


Yes exception() overrides the DLC. I can not set all the options on the DLC
rather than on the exception type as I have to handle the exceptions
depending on the type.

Is there any other alternative?

Pratibha
-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18975591.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by pratibhaG <pr...@in2m.com>.
Yes exception() overrides the DLC. I can not set all the options on the DLC
rather than on the exception type as I have to handle the exceptions
depending on the type.

Is there any other alternative?

Pratibha
-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18975591.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Ah 

I think the exception() stuff will override the DLC. However you can set all the options on the DLC and *not* on the exception type. But then its global for all exceptions.

I have added the JIRA to add it in Camel 1.5.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Claus Ibsen [mailto:ci@silverbullet.dk] 
Sent: 13. august 2008 15:55
To: camel-user@activemq.apache.org
Subject: RE: camel 1.4 redelivery issue

Hi

Ah it's exposed on the DLC so you can set it on the DLC. 
     deadLetterChannel().maximumRedeliveryDelay(9999999L);

And then you original code (without the maximumRedeliveryDelay)
exception(java.net.SocketException.class)
		.maximumRedeliveries(5)
		.useExponentialBackOff()
		.initialRedeliveryDelay(300000)
		.backOffMultiplier(2.0)
		.intercept(new CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));


And then you can have the other settings per redelivery policy you have configured. However then it's a global setting and not curtom per. Redelivery policy (probably a missing in Camel 1.4). I will add a JIRA for this.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: pratibhaG [mailto:pratibha.ghogale@in2m.com] 
Sent: 13. august 2008 15:29
To: camel-user@activemq.apache.org
Subject: RE: camel 1.4 redelivery issue


I need to have the time more than 60 seconds, as if an application is down,
reason can be anything and it may take more than even half an hour. If I hit
it every 60 seconds it will unnecessarily create traffic.

I want to do something like this:
exception(java.net.SocketException.class)
		.maximumRedeliveries(5)
		.useExponentialBackOff()
		.initialRedeliveryDelay(300000)
		.backOffMultiplier(2.0)
                .maximumRedeliveryDelay(99999999L)                 
		.intercept(new CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));
    	  

If I have not misunderstood the camel 1.4 source code, class
RedeliveryPolicy has the default setting for  maximumRedeliveryDelay to 60
seconds.

It also has a setter method for changing it. So this class has everything
and I want to use it by writing some custom code as follows:

1)Extend class org.apache.camel.model.ExceptionType in custom say class
CustomExceptionType
2)CustomExceptionType will have a method 

public ExceptionType maximumRedeliveryDelay(long maximumRedeliveryDelay) {

       
getOrCreateRedeliveryPolicy().maximumRedeliveryDelay(maximumRedeliveryDelay);

        return this;

}

3)CustomExceptionType will override following method method 
protected RedeliveryPolicyType getOrCreateRedeliveryPolicy() {

        if (redeliveryPolicy == null) {

            redeliveryPolicy = new CustomRedeliveryPolicyType();

        }

        return redeliveryPolicy;

    }


3)I also have to extend class org.apache.camel.model.RedeliveryPolicyType to
have maximumRedeliveryDelay.
I will create class CustomRedeliveryPolicyType which will extend
org.apache.camel.model.RedeliveryPolicyType and have setters and getters for
maximumRedeliveryDelay.

What do you think about this solution?

I don't know how can I tell my Routing java (DSL) to use my
CustomExceptionType rather than org.apache.camel.model.ExceptionType as
currently it uses org.apache.camel.model.ExceptionType by default.

How to do this? Please help.
-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18963077.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Ah it's exposed on the DLC so you can set it on the DLC. 
     deadLetterChannel().maximumRedeliveryDelay(9999999L);

And then you original code (without the maximumRedeliveryDelay)
exception(java.net.SocketException.class)
		.maximumRedeliveries(5)
		.useExponentialBackOff()
		.initialRedeliveryDelay(300000)
		.backOffMultiplier(2.0)
		.intercept(new CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));


And then you can have the other settings per redelivery policy you have configured. However then it's a global setting and not curtom per. Redelivery policy (probably a missing in Camel 1.4). I will add a JIRA for this.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: pratibhaG [mailto:pratibha.ghogale@in2m.com] 
Sent: 13. august 2008 15:29
To: camel-user@activemq.apache.org
Subject: RE: camel 1.4 redelivery issue


I need to have the time more than 60 seconds, as if an application is down,
reason can be anything and it may take more than even half an hour. If I hit
it every 60 seconds it will unnecessarily create traffic.

I want to do something like this:
exception(java.net.SocketException.class)
		.maximumRedeliveries(5)
		.useExponentialBackOff()
		.initialRedeliveryDelay(300000)
		.backOffMultiplier(2.0)
                .maximumRedeliveryDelay(99999999L)                 
		.intercept(new CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));
    	  

If I have not misunderstood the camel 1.4 source code, class
RedeliveryPolicy has the default setting for  maximumRedeliveryDelay to 60
seconds.

It also has a setter method for changing it. So this class has everything
and I want to use it by writing some custom code as follows:

1)Extend class org.apache.camel.model.ExceptionType in custom say class
CustomExceptionType
2)CustomExceptionType will have a method 

public ExceptionType maximumRedeliveryDelay(long maximumRedeliveryDelay) {

       
getOrCreateRedeliveryPolicy().maximumRedeliveryDelay(maximumRedeliveryDelay);

        return this;

}

3)CustomExceptionType will override following method method 
protected RedeliveryPolicyType getOrCreateRedeliveryPolicy() {

        if (redeliveryPolicy == null) {

            redeliveryPolicy = new CustomRedeliveryPolicyType();

        }

        return redeliveryPolicy;

    }


3)I also have to extend class org.apache.camel.model.RedeliveryPolicyType to
have maximumRedeliveryDelay.
I will create class CustomRedeliveryPolicyType which will extend
org.apache.camel.model.RedeliveryPolicyType and have setters and getters for
maximumRedeliveryDelay.

What do you think about this solution?

I don't know how can I tell my Routing java (DSL) to use my
CustomExceptionType rather than org.apache.camel.model.ExceptionType as
currently it uses org.apache.camel.model.ExceptionType by default.

How to do this? Please help.
-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18963077.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by pratibhaG <pr...@in2m.com>.
I need to have the time more than 60 seconds, as if an application is down,
reason can be anything and it may take more than even half an hour. If I hit
it every 60 seconds it will unnecessarily create traffic.

I want to do something like this:
exception(java.net.SocketException.class)
		.maximumRedeliveries(5)
		.useExponentialBackOff()
		.initialRedeliveryDelay(300000)
		.backOffMultiplier(2.0)
                .maximumRedeliveryDelay(99999999L)                 
		.intercept(new CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));
    	  

If I have not misunderstood the camel 1.4 source code, class
RedeliveryPolicy has the default setting for  maximumRedeliveryDelay to 60
seconds.

It also has a setter method for changing it. So this class has everything
and I want to use it by writing some custom code as follows:

1)Extend class org.apache.camel.model.ExceptionType in custom say class
CustomExceptionType
2)CustomExceptionType will have a method 

public ExceptionType maximumRedeliveryDelay(long maximumRedeliveryDelay) {

       
getOrCreateRedeliveryPolicy().maximumRedeliveryDelay(maximumRedeliveryDelay);

        return this;

}

3)CustomExceptionType will override following method method 
protected RedeliveryPolicyType getOrCreateRedeliveryPolicy() {

        if (redeliveryPolicy == null) {

            redeliveryPolicy = new CustomRedeliveryPolicyType();

        }

        return redeliveryPolicy;

    }


3)I also have to extend class org.apache.camel.model.RedeliveryPolicyType to
have maximumRedeliveryDelay.
I will create class CustomRedeliveryPolicyType which will extend
org.apache.camel.model.RedeliveryPolicyType and have setters and getters for
maximumRedeliveryDelay.

What do you think about this solution?

I don't know how can I tell my Routing java (DSL) to use my
CustomExceptionType rather than org.apache.camel.model.ExceptionType as
currently it uses org.apache.camel.model.ExceptionType by default.

How to do this? Please help.
-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18963077.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Do you really want such high redelivery delay > 60 sec?

Can you not just have a higher redelivery count such as 100 - the it will try 100 times but once a minute? 

Otherwise you can patch the code from the 1.4 and create a 1.4.1 jar that you have in your local maven repo.

Or you can extend the DeadLetterChannel in Camel and change the code that has the 60 sec max to something higher and then you can use your class as the default error handler.

errorHandler(new MyOwnErrorHandler());


http://activemq.apache.org/camel/error-handler.html
Unfortunately we don't have such a sample on the wiki I can see (something we should add)



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: pratibhaG [mailto:pratibha.ghogale@in2m.com] 
Sent: 13. august 2008 13:48
To: camel-user@activemq.apache.org
Subject: RE: camel 1.4 redelivery issue


I tried it, but it is not exposed in DSL.

I am using camel 1.4 inside servicemix so can not move from 1.4 to 1.5.

Is there any work around which i can follow?
If you have any please share it.

Pratibha
-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18961540.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by pratibhaG <pr...@in2m.com>.
I tried it, but it is not exposed in DSL.

I am using camel 1.4 inside servicemix so can not move from 1.4 to 1.5.

Is there any work around which i can follow?
If you have any please share it.

Pratibha
-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18961540.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel 1.4 redelivery issue

Posted by Claus Ibsen <ci...@silverbullet.dk>.
And the new option maximumRedeliveryDelay isn't exposed in the DSL?
.maximumRedeliveryDelay(99999999L)

If not then I think we could expose it in Camel 1.5 and then you can configure it.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: pratibhaG [mailto:pratibha.ghogale@in2m.com] 
Sent: 13. august 2008 11:57
To: camel-user@activemq.apache.org
Subject: camel 1.4 redelivery issue


I have following configuration:
exception(java.net.SocketException.class)
        .maximumRedeliveries(5)
        .useExponentialBackOff()
        .initialRedeliveryDelay(300000L)
        .backOffMultiplier(2.0)
        .intercept(new
CustomDelegateProcessor(ErrorConstants.SOCKET_ERROR));
          
Here the message should be redelivered first after 300000 ms and then
increase exponentially. But this works unexpected. It redelivers the message
every 60000ms. 

Is it because the new feature 
maximumRedeliveryDelay = 60 * 1000L (60 seconds, new option in Camel 1.4)

How can I change maximumRedeliveryDelay. Currently if I set
initialRedeliveryDelay(30000L), it works fine for first attempt that is when
the time is less than 60000ms. But if the value is more than 60000L it doe
not. 

how can I solve this?

please help

Pratibha
-- 
View this message in context: http://www.nabble.com/camel-1.4-redelivery-issue-tp18960138s22882p18960138.html
Sent from the Camel - Users mailing list archive at Nabble.com.