gpt4 book ai didi

java - 如何定义Spring Integration errorChannel?

转载 作者:行者123 更新时间:2023-12-02 12:12:14 29 4
gpt4 key购买 nike

在之前的 Spring 集成应用程序中,我能够订阅应用程序 errorChannel,并且我的失败消息(向外发送)最终会出现在我的(预-定义的)处理程序。

但是,现在我正在尝试在一个更大的应用程序中实现相同的模式,该应用程序具有预先存在的入站设置,并且我无法再在 errorChannel 上进行接收.

最令我震惊的是:

<int:publish-subscribe-channel id="errorChannel" task-executor="errorChannelExecutor"/>

当我启动此应用程序并加入后,我不再看到以下令人放心的消息:

No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
Adding {logging-channel-adapter:o.s.i.errorLogger} as a subscriber to the 'errorChannel' channel
Channel'o.s.c.s.C.errorChannel' has 2 subscriber(s).
  1. 您认为 int:publish-subscribe-channel最重要的我对应用程序错误 channel 的访问?
  2. 为什么它不再引用日志中的默认 errorChannel?
  3. 有没有办法可以定义一个仅与出站连接相关的备用错误 channel

最佳答案

使用异步任务执行器时,执行器捕获的异常默认会发送到名为 errorChannel 的 channel 。

如果您定义这样的 channel ,它将覆盖框架创建的默认 channel (并且订阅它的日志适配器不会被订阅;如果您定义自己的 channel ,则必须这样做)。

对于消息驱动的入站 channel 适配器/网关(例如 http、amqp 等),如果没有下游异步执行器,则必须显式设置 error-channel 属性如果你想要异常(exception)去那里。

关于java - 如何定义Spring Integration errorChannel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46452945/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com