最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

spring - How do I catch exceptions from my MqttPahoMessageHandler to perform recovery or timeout processing? - Stack Overflow

programmeradmin0浏览0评论

I'm currently implementing a process for receiving MQTT frames and then exporting them to another MQTT broker. Except that the broker in question is sometimes not accessible. It is therefore important for me to manage my errors when sending this frame.

Here's the current flow I've put in place :

@Bean
public IntegrationFlow telemetryFlow() {
    return IntegrationFlow
        .from(broadcastChannel)
        .handle(thingsBoardPubMqttHandler)
        .get();
}

I've tried to set up a parallel flow to this one with the default error channel as from. But when I take the exception, it is never called with the exception :

@Bean
public IntegrationFlow errorFlow() {
    return IntegrationFlow.from(errorChannel())
        .log(LoggingHandler.Level.ERROR)
        .get();
}

Here is my current spring integration configuration

spring.integration.channels.autoCreate=true
spring.integration.channels.error.requireSubscribers=true
spring.integration.taskScheduler.poolSize=10
spring.integration.readOnly.headers=
spring.integration.channels.maxUnicastSubscribers=2147483647
spring.integration.endpoints.noAutoStartup=
spring.integration.channels.error.ignoreFailures=false
spring.integration.messagingTemplate.throwExceptionOnLateReply=false
spring.integration.channels.maxBroadcastSubscribers=2147483647
spring.integration.endpoints.defaultTimeout=30000

Thank you in advance for your feedback

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论