Per thread how many consumers are allowed, and can the consumer be multi-threaded?

One; Not multi-threaded

A Kafka consumer is not thread-safe, so one thread should own a single consumer instance and use it in that thread only. If you need parallelism, run multiple consumer instances in the same consumer group, each in its own thread. Kafka assigns partitions to the consumers in the group, and a partition is consumed by exactly one consumer, which enables parallel work across the group. Therefore, per thread there is one consumer, and that consumer should not be multi-threaded. You can still process messages concurrently by handing off records to a worker pool after polling, but the consumer object itself remains single-threaded.

Two; Multi-threaded

One; Multi-threaded

Unlimited; Not allowed

Want more questions?

All options are one-time payments.

$25.99

30 day pass for new members

All the basics to get you started

  • Ad-free experience
  • View your previous attempt history
  • Mobile app access
  • In-depth explanations
  • 30 day premium pass access
$59.99$171.99 usd

6 month DELUXE pass (most popular)

Full access FOR 6 MONTHS! & the ultimate digital PDF study guide (BONUS)

  • $171.99 usd value for $59.99! You save $106!
  • Ad-free experience
  • View your previous attempt history
  • Mobile app access
  • In-depth explanations
  • 6 months of full access
  • Ultimate digital PDF study guide included
  • Priority support
$15.99 $24.99

Ultimate digital PDF study guide

For those that prefer a more traditional form of learning

  • Available for instant download
  • Available offline
  • Hundreds of practice multiple choice questions
  • Comprehensive content
  • Detailed explanations
Image Description
Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy