Kafka - Delay binding until complex service initialisation has completed

被刻印的时光 ゝ 提交于 2019-12-11 04:07:44

问题


I'm using Spring Cloud Stream Kafka, but I have a particular service that has a complex start-up dependency (long-running) that can be rather fragile so would like to delay Kafka (consumer) binding until successful initialization is confirmed.

How can I achieve this?


回答1:


It's not currently possible with Spring Cloud Stream; you can do it by using Spring Kafka directly (e.g. @KafkaListener) and set the container factory's autoStartup to false. Or with Spring Integration Kafka and do the same for the inbound channel adapter.

You could do it with Spring Cloud Stream by loading the @StreamListener into a child boot application instead of the main one.



来源:https://stackoverflow.com/questions/50351490/kafka-delay-binding-until-complex-service-initialisation-has-completed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!