Reputation: 584
I'm trying the Apache Camel technology and get into troubles.
I use the polling consumer of the Jpa Component as from() and set the @consumed annotation on my entity to change it's state at the end of the process to "successfully processed". It works fine.
But in case of any error I don't want to set the flag "successfully processed" in my database but something like "error occurs".
To solve this problem I create a "dead letter queue" with a processor which try to change the state of my ongoing entity in order to be saved later in database. But the process is always marked as completed so the @Consumed method is always called.
So my question is : How can I skip the @Consumed method in case of error? Is there a specific exchange's state to set?
Upvotes: 0
Views: 299
Reputation: 55750
The @Consumed
method can have Exchange
as parameter, and there you can check if the exchange is failed, and get the caused exception or something. In any case it ought to have state if it was success or not, and then you can change the entity accordingly.
Upvotes: 1