anjireddy
anjireddy

Reputation: 25

Two Kafa Consumers with one producer and one partition

I have One producer and Two consumers with single partition . I preferred this case for handling heavy load balance on producer. But my two consumers get same data on every producer emit. I want one consumer should get data once and other should idle. Please suggest me solution.

Upvotes: 0

Views: 130

Answers (1)

Ryuzaki L
Ryuzaki L

Reputation: 40088

I want one consumer should get data once and other should idle. ?

If you want load balancing between consumers then they should belongs to same group, so add same group.id for both the consumers

Consumers

Consumers label themselves with a consumer group name, and each record published to a topic is delivered to one consumer instance within each subscribing consumer group. Consumer instances can be in separate processes or on separate machines.

If all the consumer instances have the same consumer group, then the records will effectively be load balanced over the consumer instances.

If all the consumer instances have different consumer groups, then each record will be broadcast to all the consumer processes.

Upvotes: 1

Related Questions