Construct an Apache Kafka client producer
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
At a high-level, a producer create records (messages) and sends them to the Apache® Kafka® cluster. A producer builder manages the configuration of a producer, such as specifying the servers and serializer. A record builder manages configuration related to the record, such as the topic name and the content of a message. Once all the configuration is set, the record is sent by the producer to the Kafka cluster. The application waits for a response to see if the message was sent successfully, and handles any errors. The application deletes the producer object when it no longer needs it.
This figure shows steps of the process:
Progress® OpenEdge® provides two ways to configure producer properties. The first is generic, where Kafka properties are configured through strings using name-value pairs. The second uses Kafka-specific classes which expose strongly-typed methods for setting properties. The advantage to using strongly-typed methods is that some errors can be caught during compile time, rather than at runtime. You can choose whatever approach works best for your application. The next topics describe both approaches.