In this section we are writing a Kafka producer that will publish events into the Kafka topic.
Perform the following step to create the producer:
- Create a Maven project by using com.stormadvance as groupId and kafka-producer as artifactId.
- Add the following dependencies for Kafka in the pom.xml file:
<dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka_2.10</artifactId> <version>0.9.0.1</version> <exclusions> <exclusion> <groupId>com.sun.jdmk</groupId> <artifactId>jmxtools</artifactId> </exclusion> <exclusion> <groupId>com.sun.jmx</groupId> <artifactId>jmxri</artifactId> </exclusion> </exclusions> </dependency> <dependency...