Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 是否需要调整提要适配器以根据事件进行操作?_Java_Spring Integration_Spring Integration Dsl - Fatal编程技术网

Java 是否需要调整提要适配器以根据事件进行操作?

Java 是否需要调整提要适配器以根据事件进行操作?,java,spring-integration,spring-integration-dsl,Java,Spring Integration,Spring Integration Dsl,场景:-假设有一个消息通道正在接收来自任何流的消息,如果该通道接收到任何消息,那么提要适配器应该拉入提要(一次),并将这些提要发布到其他通道。之后,馈电适配器应停止。是否有可能实现这一点?FeedEntryMessageSource基于: Reader reader = this.feedUrl != null ? new XmlReader(this.feedUrl) : new XmlReader(this.fe

场景:-假设有一个消息通道正在接收来自任何流的消息,如果该通道接收到任何消息,那么提要适配器应该拉入提要(一次),并将这些提要发布到其他通道。之后,馈电适配器应停止。是否有可能实现这一点?

FeedEntryMessageSource基于:

Reader reader = this.feedUrl != null
                    ? new XmlReader(this.feedUrl)
                    : new XmlReader(this.feedResource.getInputStream());
            SyndFeed feed = this.syndFeedInput.build(reader);
com.rometools:rome
库。因此,您可以利用它并构建一些定制的服务激活器,它将被来自该事件的输入通道上的消息激活

为了更好地理解提要解析逻辑,我建议查看
FeedEntryMessageSource
源代码:

更新


另一种方法是将
FeedEntryMessageSource
作为bean,并从服务激活器中引用其
receive()
方法。这样,当消息到达服务激活器的输入通道时,它将被按需调用,完全忽略消息内容。

您可以使用只触发一次的自定义触发器。看,请看我的答案