Friday, October 19, 2012

Finding Kafka JAR for building Java producers and consumers

File this one under 'why is this so hard?'.

I've started playing with Kafka and after getting a basic cluster up on 3 nodes, I started writing some code to produce my own events. It took me a good 30 minutes to figure out where the Kafka jar is to actually compile some code!

First step is to use the 'sbt' tool to build the installation. I ended up doing a couple of different targets to finally find the jar files.

./sbt update
./sbt package
./sbt package-all

Once all completed, I had to use 'find' to find the jar file to include in an IntelliJ project to compile and run a producer. The jar was finally found under C:\temp\kafka-0.7.2\core\target\scala_2.8.0\kafka-0.7.2.jar

Adding this jar to my IntelliJ project allowed me to compile and run a simple producer.