In this workshop, you learn how to implement reactive messaging functionality with Java, Quarkus, Apache Kafka, Eclipse Vert.x, and Eclipse MicroProfile. You deploy an end-to-end sample application to Red Hat® OpenShift® on IBM Cloud®. The open source code is available as part of the Cloud Native Starter project.
One benefit of reactive models is the ability to update web applications by sending messages, rather than pulling for updates. This is more efficient and improves the user experience.
This workshop uses a sample application to demonstrate reactive functionality. The simple application displays links to articles and author information. Articles can be created via REST API. The web application receives a notification and adds the new article to the page. The following animation shows how curl requests are executed at the bottom, which trigger updates to the web application at the top:
The following architecture diagram explains the flow between the different components and microservices of the application:
SubmissionsAPI client triggers the REST API of the
Articlesservice to create new articles.
Articlesservice sends a message to the
Web-APIprovides a streaming endpoint.
Web-Appweb application consumes the streaming endpoint.
After you complete this workshop, you’ll understand the following reactive functionality:
- Sending and receiving Kafka messages via MicroProfile
- Sending events from microservices to web applications via Server Sent Events
- Sending in-memory messages via MicroProfile and Vert.x Event Bus
The intention of this workshop is not to explain every aspect of reactive programming, but to explain core reactive principles and to deploy a complete reactive application which you can inspect in more detail after the workshop.
This beginner level workshop will take you about one hour to complete.
- Create your work environment
- Deploy Kafka with a script
- Deploy a Postgres database with an operator
- Deploy the sample application
- Implement reactive messaging with MicroProfile
- Use Server Sent Events to stream a message to the web application
- Use the Vert.x Event Bus to communicate between different application parts
- (Optional) Use distributed logging
After you finish the labs within this workshop, try the Reactive endpoints with Quarkus on OpenShift workshop, which focuses on reactive APIs and API invocations. It uses the same sample Web application as this one.