Jesús Chacón
Jesús Chacón

Reputation: 187

Spring Integration - Message Driven Channel Adapter - transformer error handle, original message

i have a problem handling errors within a flow of spring integration. The flow works like this my entry point is a message driven channel adapter -> router -> filter -> transformer -> service activator -> Database. I've wrote my own error handler using a custom Message Listener Container, and it works as expected, but i need to save the original message into a database when i get an exception.

The problem is that, when i get an exception from the database, the error handle strategy recive a MessageHandleException, but the failedMessage in the exception is the message transformed, how can i get the original message in this case?

Thanks for your help.

Upvotes: 2

Views: 224

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121552

You should use header-enricher just after message driven channel adapter:

<int:header-enricher>
   <int:header name="originalPayload" expression="payload"/>
</int:header-enricher>

And use this header from that failedMessage in your own error handler.

Upvotes: 2

Related Questions