Bird
0
0

You want to publish user activity events to Kafka so multiple services can react in real time. Which approach best fits this use case?

hard📝 Application Q15 of 15
Kafka - Producers
You want to publish user activity events to Kafka so multiple services can react in real time. Which approach best fits this use case?
AWrite user events to a local file and have services read the file
BUse a Kafka producer to send serialized event data to a shared topic named <code>user-activity</code>
CSend user events directly to each service via HTTP requests
DStore user events in a database and poll it periodically
Step-by-Step Solution
Solution:
  1. Step 1: Identify real-time data sharing method

    Kafka producers send data to topics that multiple consumers can read in real time.
  2. Step 2: Match use case to Kafka producer pattern

    Sending serialized events to a shared topic allows all services to react immediately.
  3. Final Answer:

    Use a Kafka producer to send serialized event data to a shared topic named user-activity -> Option B
  4. Quick Check:

    Producers publish events to topics for real-time sharing [OK]
Quick Trick: Use Kafka topic for real-time multi-service events [OK]
Common Mistakes:
  • Using files or DB polling which are not real-time
  • Sending HTTP requests to each service manually
  • Not using Kafka topics for event distribution

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes