I'm currently working on a Spring Integration DSL project and I've a flow that requires handling errors differently depending on the part of the flow that fails.
My current approach was to create subFlows
by chaining .gateway
methods, but I'm having trouble handling exceptions as the .gateway
hangs indefinetly waiting for a reply after sending the message to the defined .errorChannel
, which isn't required for my case, even when I configure it as .requireReply(false)
.
Is there any other better approach to divide the flow and handle exceptions conditionally? Could .gateway
s be configured to cut the flow and call postSend
so channels are available after sending a message to the .errorChannel
?
As long as only direct channels (default) are used, you can simply set the gateway reply timeout to 0, which will prevent the thread from hanging after an error has been "consumed".