Integrating Kafka with a Helidon MicroProfile Application - Part 2

Recently I posted a very short article on using Kafka along with a Helidon MicroProfile application: It was using classic Kafka APIs and involved more manual coding. In this post, let us see how to build the same messaging solution declaratively availing the Reactive Messaging offering of MicroProfile specification. Uhh...Did I say less coding and more fun :)

What is MicroProfile Reactive Messaging?
The following doc may answer all your questions: Another interesting blog post on this topic is here: We use the same constructs with a Helidon MP application in this example.

What is the usecase exercised in this example ?
It is simple :) We use the a simple greeting REST API  to exercise the Kafka messaging feature. When a client updates the greeting message, the Greeting resource implementation will publish the new greeting message to Kafka topic for use by interested parties(consumers)

Who does what?
Here is quick summary of the classes that you find in the example application:

RxMessagingKafkaConsumer: This class listens to the Kafka topic using the MicroProfile Reactive Messaging declarative constructs.
RxMessagingKafkaProducer:  This class publishes messages to the Kafka topic using the MicroProfile Reactive Messaging declarative constructs. It is used by GreetResource class.
GreetResource: This is the REST resource implementation used in this example. When updateGreeting method is called
via REST PUT operation, the new greeting sent by client is sent to Kafka queue for consumption by the Kafka consumers. See the method updateGreeting() in GreetResource class to learn the usage of RxMessagingKafkaProducer APIs in order to publish message to topic. This config file holds the Kafka configuration used in this example

How to run this example?
All instructions are available here:


  1. Nice reading, I love your content. This is really a fantastic and informative post. Keep it up and if you are looking for Serp Api then visit SERPHouse.


Post a Comment