Workshop: Reactive messaging with Quarkus on OpenShift

Introduction

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:

Animation of the Cloud Native Starter project's sample web application

The following architecture diagram explains the flow between the different components and microservices of the application:

Flow diagram of the Cloud Native Starter project's sample web application

  1. The Submissions API client triggers the REST API of the Articles service to create new articles.
  2. The Articles service sends a message to the Web-API service via Kafka.
  3. The Web-API provides a streaming endpoint.
  4. The Web-App web application consumes the streaming endpoint.

Objectives

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.

Estimated time

This beginner level workshop will take you about one hour to complete.

Labs

Next steps

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.