![](/img/trans.png)
[英]Spring Boot Kafka Consumers does not consume in the order the messages are produced
[英]Inject all Kafka Consumers created by a ConcurrentMessageListenerContainer in Spring Boot?
我們正在使用ConcurrentMessageListenerContainer
來創建我們的 Kafka Consumer
。
使用ConcurrentMessageListenerContainer#concurrency
屬性可以創建多個消費者。
是否有可能在 Spring Boot 應用程序中注入ConcurrentMessageListenerContainer
創建的所有Consumer
? 或者是否有可能在ApplicationEvent
之后以某種方式獲得它們?
為什么需要訪問底層的Consumer
對象? 它們由容器管理。
消費者在消息偵聽器中作為參數可用,並包含在已發布的事件中,但不建議直接使用Consumer
API,因為這樣的用法可能與容器的預期沖突。
可以使用被動 API,例如獲取訂閱主題的結束偏移量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.