My understanding is that Spring-kafka manages concurrency within a service. i.e. a listener will only consume messages from an assigned partition.
如果有多种服务(可能与自己的一组听众一起)的话,情况是否如此?
例如,有2个有3名听众的服务(同一组各有3名)从一个有6个分位的专题中消耗。
My understanding is that Spring-kafka manages concurrency within a service. i.e. a listener will only consume messages from an assigned partition.
如果有多种服务(可能与自己的一组听众一起)的话,情况是否如此?
例如,有2个有3名听众的服务(同一组各有3名)从一个有6个分位的专题中消耗。
大赦国际的答复非常准确:
Q: With spring boot microservice and spring-kafka, if my topic has two partitions and I set the concurrency to 2, what would happen if I start a second service instance? Will there be 4 consumers in the same group and 2 of them starves?
A: In a Spring Boot microservice with Spring-Kafka, if your topic has two partitions and you set the concurrency to 2, it means that you have two threads in your KafkaListener, each of which can consume from a separate partition.
当你开始第二次服务时,还将创造另外两个消费者(假设同一组合)。 这些消费者将加入同一个消费者群体。 然而,由于这个专题只有两个分门别类,每个分门别类只能由一个消费者在某个群体消费,因此两名消费者不会收到任何信息。 这是因为,卡夫卡的消费者议定书将在新消费者加入消费者团体时引发重新平衡,而在重新平衡的过程中,卡夫卡将努力将这一议题分给集团所有消费者,以实现负荷平衡。
因此,在您的设想中,如果另外两个消费者都活着并使用电文,那么你实际上会有4个消费者,但其中2个消费者不会收到任何电文。 这常常被称作消费者团体中的“星号”。 如果活跃的消费者之一倒闭,卡夫卡将引发另一种再平衡,而“星号”消费者之一将开始接收信息。
请注意,这一行为基于Kafka的设计,以确保分治中的每一电文都按顺序使用。 如果你想增加投入,你可以考虑增加贵国专题的分部分数目。 但记得,更多的分门别类可能会导致更多的平衡,从而影响业绩。 必须根据您的具体使用情况找到平衡点。
I m using python 3.9.16 and kafka-python version 2.0.2. I m running on my Macbook Pro IOS 11.6.5. I m still getting my feet wet with Kafka so it s entirely possible I m doing things the wrong way. ...
Environment: flink 1.13.6 on yarn Application: flink api stream application, consume one topic named a with group.id g , with checkpoint, auto commit offset is closed, offset committment is ...
Issue I have a Spark application in Scala in Amazon EMR. It tries to write data to Kafka in Amazon MSK through IAM authentication way. I have created a topic called hm.motor.avro in the Amazon MSK by: ...
I need the consumer to read messages from the topic not immediately, but after a certain time interval. In my case, this time = 10 seconds. I made a KafkaConfig in which I specified the properties and ...
Summary Developing a Spark application using Java for financial analytics. Apache Kafka is being used for streaming data in conjunction with Spark Struct Streaming API for reading data. group_by() and ...
I have a Spring Boot Kafka Stream application that reads the records do some HTTP calls and transform the record into another form. This transform record is then sent to the producer. final KStream<...
We are trying to implement a streaming ingestion from Kafka using Databricks. Here is our Spark job: # Databricks notebook source from pyspark.sql import SparkSession from pyspark.sql.functions import ...
I am trying to filter the record in Kafka Lenses base on the value of an object nested in array. I want to find all records with engineer "id" : "555" in an array. This are two ...