Handle expected return from Spring Integration File

陌路散爱 提交于 2019-12-07 15:28:34

The @ServiceActivator has an outputChannel attribute:

/**
 * Specify the channel to which this service activator will send any replies.
 * @return The channel name.
 */
String outputChannel() default "";

That's for successful replies.

Any exceptions (independently of the setExpectReply()) are just thrown to the caller. In your case the story is about an @InboundChannelAdapter. In this case the exception is caught and wrapped to the ErrorMessage to be sent to the errorChannel on the @Poller. It is a global errorChannel by default: https://docs.spring.io/spring-integration/docs/5.0.4.RELEASE/reference/html/configuration.html#namespace-errorhandler

However you have some other problem in your code. I see the second subscriber to the FILE_CHANNEL_PROCESSING. If it's not a PublishSubscribeChannel, you are going to have a round-robin distribution for messages sent to this channel. But that's already a different story. Just don't ask that question here, please!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!