首页 > 解决方案 > 如何使 Spring Cloud Stream 中流中未处理异常的控制台输出静音?

问题描述

使用 Spring Cloud Stream 和 Kafka binder,我有一个非常简单的处理器绑定到 SI 流:

    @Bean
    @Autowired
    public IntegrationFlow inputFlow(Thrower thrower) {
        return IntegrationFlows
            .from(ApplicationBinding.INPUT)
            .handle(thrower))
            .channel("nullChannel")
            .get()
    }

throwerbean 只是抛出RuntimeException一个.

RuntimeException似乎被 a 包裹并MessageProcessingException转储到控制台。

如何使该控制台输出静音并保持所有其他行为相同?

我已经配置spring.cloud.stream.bindings.error.destination=errorChannel但绑定一个处理程序(像这样)似乎没有让我玩任何事件:

    @ServiceActivator(inputChannel = "errorChannel")
    public void errors(ErrorMessage em) {
        log.info("Heyooo {}", em);
    }

标签: spring-cloud-stream

解决方案


推荐阅读