Producers
Producers are applications that create messages and publish them to the broker. Normally, producers are: frontend applications, web pages, web services, backend services, proxies, and adapters to legacy systems. We can write Kafka producers in Java, Scala, C and Python.
The process begins when the producer connects to any live node and requests the metadata about the partitions leaders of a topic, to put the message directly to the partition lead broker.
Producer API
First, we need to understand the classes needed to write a producer:
- Producer: The producer class is
KafkaProducer <K, V>
inorg.apache.kafka.clients.producer.KafkaProducer
Kafka Producer is a type of Java Generic written in Scala, K specifies the type of the partition key and ...
Get Fast Data Processing Systems with SMACK Stack now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.