/
Producers

Producers

Producer classes help in pushing data from the application to kafka topics. For this, we have a custom implementation of KafkaTemplate class in our tracer library called CustomKafkaTemplate. This implementation of producer class does not change across services of DIGIT. Producer implementation can be viewed here - Producer Implementation

Now, for adding producer support in this guide, the following steps need to be followed -

i) Update tracer version in pom.xml to 2.0.0-SNAPSHOT

ii) Create a producer folder and add a new class to it by the name of Producer. Add the following code the this class -

@Service @Slf4j public class Producer { @Autowired private CustomKafkaTemplate<String, Object> kafkaTemplate; public void push(String topic, Object value) { kafkaTemplate.send(topic, value); } }

Related content

Writing a new Consumer
Writing a new Consumer
More like this
Notification Consumer
Notification Consumer
More like this
Kafka Connectors for Digit
Kafka Connectors for Digit
More like this
State specific service changes
State specific service changes
More like this
State specific service changes
State specific service changes
More like this
Mongo Kafka Source Connector
Mongo Kafka Source Connector
More like this