简体   繁体   English

使用spring cloud stream kafka读取消息的编程方式

[英]Programmatic way to read message using spring cloud stream kafka

I have a topic and DLQ associated with it.我有一个主题和与之相关的 DLQ。 I am using @StreamListener for the topic.我正在使用@StreamListener 作为主题。 I wanted to read/process the messages from the DLQ on demand using a controller endpoint.我想使用控制器端点按需读取/处理来自 DLQ 的消息。

is it possible to do this using spring cloud stream Kafka.是否可以使用 spring 云流 Kafka 来做到这一点。

We are not using actuator in production.我们没有在生产中使用执行器。 So can not use /bindings endpoints.所以不能使用 /bindings 端点。

You don't need to enable the actuators over web, but you need to add the actuator starter to the class path;您不需要通过网络启用执行器,但需要将执行器启动器添加到类路径中; then you can use the technique in the answer to this question: Stop consume message for Stream listener那么您可以在这个问题的答案中使用该技术: 停止为 Stream 侦听器使用消息

As noted in the comments there, there is an open issue to separate the functionality from the actuator.正如那里的评论中所指出的,将功能与执行器分开是一个悬而未决的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM