Publish Subscribe

In this exercise, we will explore the fundamental Enterprise Integration Pattern - Publish/Subscribe. You will implement a custom Kafka producer and consumer, gaining hands-on experience with Kafka. This is very easy, starting point for everyone who likes to star play with Kafka.

  1. Clone repository https://github.com/pszymczyk/kafka-native-java-playground
  2. Checkout step1 branch
  3. Go to the PublishRunner class, in the main(...) method implement sending messages to the topic step1.
  4. Send a message in given formatĀ 
    1. My favourite number is $randomNumber
  5. Display in the application logs details of each message sent: topic, partition, offset
  6. Go to the SubscribeRunner class, in main(...) method implement consumer loop, use given methods:
    1. subscribe(...)
    2. poll(...)
  7. Display in the application logs details of each message read: topic, partition, offset
  8. Run PublishRunner and SubscribeRunner
  9. Check the application logs