How to route the flow from the channel myChannel to the error channel myErrorChannel if there occurs an error in the Http.outboundGateway call?
@Bean
private IntegrationFlow myChannel() {
return f -> f
.handle(Http.outboundGateway("http://localhost:8080/greeting")
...
.expectedResponseType(String.class));
}
@Bean
private IntegrationFlow myErrorChannel() {
return f -> f
...
}
In the error handler I will wrap the error message inside my custom JSON and I will send that as a part of the normal flow back to the source system.
Is this a good way to handle errors in the Spring Integration Java DSL?