Get the current partition assignments.
Gracefully close the consumer.
Commits offsets (if auto-commit is enabled), leaves the consumer group, and stops all timers.
Commit offsets for all consumed partitions.
Commits the current fetch position for each assigned partition.
Connect to the group coordinator and join the consumer group.
Discovers the coordinator, joins the group, receives partition assignments, and starts heartbeating.
Poll for new records from assigned partitions.
Sends Fetch requests to the brokers holding the assigned partitions and returns any records received. If no records are available within the timeout, returns an empty array.
Also handles rebalance signals from heartbeat responses and triggers rejoin when necessary.
Optional_timeoutMs: numberMaximum time to wait for records (reserved for future use).
Consumer records from the assigned partitions.
Kafka consumer with consumer group support.
Handles the full consumer group lifecycle: joining, syncing, heartbeating, fetching records, committing offsets, and graceful shutdown.
Example