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

spring cloud stream - how to handle a kafka topic failure with streambridge.send - Stack Overflow

programmeradmin3浏览0评论

I have a service that handles kafka events. It publishes events to a topic then updates some attributes of that event in a db. I realized that in some cases, streambridge.send will return true, thought the event was never published, which will result in the new attributes being set. I.e a Not authorized to access topics exception. How can I reliably ensure events are published to Kafka using Streambridge, preventing data inconsistencies when exceptions occur?

Wondering, if there is way to return false as part of that operation or a way to handle the asynchronous failure since it happens after streambridge.send which I read does not guarantee delivery to the topic.

Would configuring ack=1 force streambridge to wait until receiption of the message?

Boolean Sent=Streambridge.send(name, dbmessage)
If(!sent){
Throw new runtimeException(“failed to send”)}
dbmessage.setSent(true)
发布评论

评论列表(0)

  1. 暂无评论