Confuse Developer
Confuse Developer

Reputation: 17

Spring Integration error channel solution

Hello I'm very very new to Spring Integration.

I have known that error channel throws exception parameter to the channel.

but when program are working in error handling I need to get the current state before exception occur(eg. an object that setting some value in main process or string)

the question is how can I sent other parameter(eg. an object) come with exception to error channel?

or I have to use other solution?

thank you,

Upvotes: 1

Views: 506

Answers (1)

rocky
rocky

Reputation: 5004

well, you get something like (Message < MessageHandlingException > msg ) as parameter in error handler method. Then using

msg.getPayload().getFailedMessage()

you gain access to message which failed. If its not enough then you can set your object as header with < header-enricher > somewhere before possible exception and fetch it in you error handler:

msg.getPayload().getFailedMessage().getHeaders().get("trackedImage");

Upvotes: 3

Related Questions