Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring SCS-使用卡夫卡中最后一条可用消息_Spring_Spring Integration_Spring Cloud Stream_Spring Kafka - Fatal编程技术网

Spring SCS-使用卡夫卡中最后一条可用消息

Spring SCS-使用卡夫卡中最后一条可用消息,spring,spring-integration,spring-cloud-stream,spring-kafka,Spring,Spring Integration,Spring Cloud Stream,Spring Kafka,我有一个场景,我想在启动时使用写在卡夫卡主题上的最后一条消息。例如,如果有一个带有单个分区的“deal_config”主题,并且有三条消息,如1 | 2 | 3,那么在启动时,我只想使用消息3。如果我设置为startOffset到latest,我只能使用新消息。理想情况下,我的消费者应该阅读分区中最新消息的偏移量,并消费其中的-1。一位智者曾经说过,阅读手册 Spring Cloud Stream未公开该功能-您可以使用@KafkaListener替代,使用ConsumerSekAware侦听器

我有一个场景,我想在启动时使用写在卡夫卡主题上的最后一条消息。例如,如果有一个带有单个分区的“deal_config”主题,并且有三条消息,如
1 | 2 | 3
,那么在启动时,我只想使用消息3。如果我设置为
startOffset
latest
,我只能使用新消息。理想情况下,我的消费者应该阅读分区中最新消息的偏移量,并消费其中的-1。

一位智者曾经说过,阅读手册

Spring Cloud Stream未公开该功能-您可以使用
@KafkaListener
替代,使用
ConsumerSekAware
侦听器。

@GrayRussell。我可以在使用S-C-S卡夫卡活页夹的项目中使用卡夫卡吗。我的需要是玩fewtopics的offset,所有其他消费者总是读取最新的offset。因此,我在项目中使用了StreamListner和KafkaListener(与ConsumerSekAware一起),该项目有spring cloud stream活页夹kafka 1.2.1和spring kafka 1.2.1(覆盖)版本。但是卡夫卡利斯纳永远不会工作,也不会抛出异常。不会使用消息,也不会调用my ConsumerSekAware方法。是;您可以在同一个应用程序中使用这两种方法。提出一个新问题,显示不适合您的代码片段。