camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "mike.cunningham109@gmail.com" <mike.cunningham...@gmail.com>
Subject IdempotentRepository key removal within OnException
Date Mon, 25 Apr 2016 21:25:07 GMT
Hi,

I have the below routes setup. 

The behaviour that I am noticing is that the key within the Idempotent
Repository is not being removed when an exception is thrown when using the
'seda' component in the OnException (on line stated below). 

If I change to use 'direct' instead of 'seda' within the OnException then
the key is correctly removed from the cache when the exception is thrown. 

I am using MemoryIdempotentRepository and the version of Apache Camel is
2.16.2.

Can you please help me with my queries:

    1) why would the key not be removed from the repository cache when using
'seda' within the OnException?
    2) is there an issue with using 'seda' within the OnException?


Here is a snapshot of the routes:

In MyRouteClass1
 
 ....
 
 private IdempotentRepository<String> duplicatesRepo =
MemoryIdempotentRepository.memoryIdempotentRepository(100);
 
 
onException(Exception.class)
  .setHeader("subjectText", simple("failure email!"))
  .to("seda:notifySupportOnFailure")
  .end();

from("direct:findWorkItems")
    .bean(someService, "findWorkItems")
    .split(body())
      .throttle(1).timePeriodMillis(5000L)
      .to("direct:handleWorkItem")
      .choice().when(header("resultId").isGreaterThan(0))
      .bean(someService, "updateWorkItemToHandled")
      .end();

from("direct:handleWorkItem")
    .idempotentConsumer(simple("${body.workItemId}"), duplicatesRepo)
    .bean(someService, "handleWorkItem")  // e.g. exception would be thrown
within here
    .setHeader("resultId", body())
    .end();

	
In MyRouteClass2

from("seda:notifySupportOnFailure")
  .setHeader("from", simple("sender@mail.com"))
  .setHeader("to", simple("recipient@mail.com"))
  .setBody(simple("Failure:\n ${exception.message} \n\ndetail: \n${body}"))
  .to("smtp://localhost")
  .log("Failure email now sent.")
  .end();




--
View this message in context: http://camel.465427.n5.nabble.com/IdempotentRepository-key-removal-within-OnException-tp5781682.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message