In my application, my gateway is receiving request identifier in header, whenever error happens, error channel receives the exception. But it seems like, errorChannel don't take the headers from gateway.
Is it possible to carry over the header information to error channel as well?
Sample example: sysout in sampleErrorChannel does not has the header which i have passed.
https://github.com/manojp1988/spring-integration/blob/master/javadsl/src/main/java/ErrorChannel/ErrorChannelExample.java
The message on the error channel is an ErrorMessage
, it has a payload of MessagingException
which has two properties, the cause
(exception) and failedMessage
.
You can access the failed message headers that way.
e.g. payload.failedMessage.headers['foo']
when using SpEL.
If using a POJO service activator on the error flow, you can use
public void failure(MessagingException failure) {
MyHeader mh = failure.getFailedMessage().getHeader("mh");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With