hummingV
hummingV

Reputation: 1074

Spring integration: propagate headers to 'errorChannel'

Is there a way to configure Spring Integration channels such that in case of uncaught exceptions, the headers at the time of exception (if available) are published to the errorChannel along with the exception object?

Right now, I can subscribe to the 'errorChannel' and adds handling code there which is extremely useful. But in errorChannel, I can only get the exception; headers from the original channel are lost. I tried looking at the reference here (https://docs.spring.io/spring-integration/reference/htmlsingle/#namespace-errorhandler) but no luck.

Upvotes: 1

Views: 452

Answers (1)

Gary Russell
Gary Russell

Reputation: 174799

The ErrorMessage payload is a MessagingException with 2 properties cause and failedMessage. The headers are available on the latter.

Upvotes: 3

Related Questions