[ 
https://issues.apache.org/jira/browse/CAMEL-4978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13200713#comment-13200713
 ] 

Andrey Kazantsev commented on CAMEL-4978:
-----------------------------------------

Please consider my example. I don't have access to code right now, so I'll 
describe in common words.

I've default error handler for my main route, which by default routes a message 
to some route where logic is executed. Default error handler is configured for 
*Unrecoverable* error, so we don't try to redelivery the message.

<errorHandler id='defaultErrorHandler' ... 
deadLetterUri='direct:unrecoverableErrors' />
<route id='mainRoute' errorHandler='defaultErrorHandler' />

However, there are some errors which are *Recoverable*, and we need to 
redeliver that messages. So I configure onException:

<onException>
  <exception>TransientException</exception>
  <redeliveryPolicy redeliveryAttemps='3' />
  <to uri='direct:recoverableErrors' />
</onException>

With this configuration, all messages with unrecoverable errors are going to 
_defaultErrorHandler_, and messages with recoverable errors are trying to 
redeliver, and when redelivery attempts are exhausted, they sent to 
_direct:recoverableErrors_. However, I need to execute some specific logic when 
recoverable error occur, and before redelivery attempt. To accomplish this in 
any way, I use onRedelivery processor, but I've a latency while next redelivery 
will be performed.

Am I doing something completely wrong and overlooked hove this can be done with 
current Camel means?
                
> Dead Letter Channel: add onError with correspondence to onRedelivery
> --------------------------------------------------------------------
>
>                 Key: CAMEL-4978
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4978
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: Future
>            Reporter: Andrey Kazantsev
>            Priority: Minor
>              Labels: features
>
> When an error occurs there can be situation when some actions should be 
> performed before next redelivery attempt. These actions can be custom logging 
> (in case of Dead Letter Channel we don't have control on logger name and 
> format), creating incident request in internal company system, etc.
> Current version of Dead Letter Channel provides support for specifying 
> processor which is called when next redelivery attempt is performed. However, 
> if delay between attempts is long, this can be too late.
> I think we can implement support for specifying processor which will be 
> called when error occurs, e.g., onError property. Then this processor with 
> information from provided Exchange can take appropriate actions. For example, 
> it can save this message for further investigation, while Dead Letter Channel 
> will keep going on redelivering it.
> If this feature is worth to be implemented, I can prepare a patch. I 
> implemented a work-around in my current project using onRedelivery, but I 
> don't like it because of latency in redelivery interval.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to