The 0.9 release of Kafka introduced a complete redesign of the kafka consumer.
If you are interested in the old SimpleConsumer (0.8.X), have a look at this page. If your Kafka installation is newer than 0.8.X, the following codes should work out of the box.
Configuration and initialization
Kaf...