Immutable solution version
Understanding Kafka Topics and Partitions
Complete solution
What a coding agent needs to know about Apache Kafka here: Understanding Kafka Topics and Partitions.
This post already has answers, but I am adding my view with a few pictures from Kafka Definitive Guide Before answering the questions, let's look at an overview of producer components:
When a producer is producing a message, it will specify the topic it wants to send the message to. Is that right? Does it care about partitions?
The producer will decide target partition to place any message, depending on:
Partition id, if it's specified within the message key % num partitions , if no partition id is mentioned Round robin if neither partition id nor message key is available in the message means only the value is available
When a subscriber is running - Does it specify its group id so that it can be part of a cluster of consumers of the same topic or several topics that this group of consumers is interested in?
You should always configure group.id unless you are using the simple assignment API and you don’t need to store offsets in Kafka. It will not be a part of any group. Source .
Does each consumer group have a corresponding partition on the broker or does each consumer have one?
In one consumer group, each partition will be processed by one consumer onl
Evidence
Asked on Stack Overflow so:38024514: Stack Overflow #38024514 (score 415, accepted answer, 447 votes): I am starting to learn Kafka. During my readings, some questions came to my mind:
When a producer is producing a message, it will specify the topic it wants to send the message to. Is that right? Does it care about partitions?
When a subscriber is running, does it specify its group id so that it can be part of a cluster of consumers of the same topic or several topics that this group of consumers is interested in?
Does each consumer group have a corresponding partition on the broker or does each consumer have one? The verified fix/answer: This post already has answers, but I am adding my view with a few pictures from Kafka Definitive Guide Before answering the questions, let's look at an overview of producer components:
When a producer is producing a message, it will specify the topic it wants to send the message to. Is that right? Does it care about partitions?
The producer will decide target partition to place any message, depending on:
Partition id, if it's specified within the message key % num partitions , if no partition id is mentioned Round robin if neither partition id nor message key is available in the message means only the value is available
When a subscriber is running - Does it specify its group id so that it can be part of a cluster of consumers of the same topic or several topics that this group of consumers is interested in?
You should always configure group.id unless you are using the simple assignment API and you don’t need to store offsets in Kafka. It will not be a part of any group. Source .
Does each consumer group have a corresponding partition on the broker or does each consumer have one?
In one consumer group, each partition will be processed by one consumer onl Source: https://stackoverflow.com/questions/38024514/understanding-kafka-topics-and-partitions
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_bI9tZmwdlGcH9nX5QAR84Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Understanding Kafka Topics and Partitions <span>— Vectle</span></a>