5.3 Microservices Setup
In this stage we will have a look at the setup and configuration of the
Task 5.3.1 - Inspect Dependencies
To simplify the use of the Outbox pattern the following dependencies have already been added to the
||Reactive Messaging extensions to receive and write Messages to or from Apache Kafka.|
||Provides a reusable, configurable component that facilitates the use of the Outbox pattern in conjunction with debezium.|
||Injects and reads tracing information from Headers of an Apache Kafka message.|
Debezium Quarkus Outbox Extension
This quarkus extension provides us with the
ExportedEvent interface. For every different event in our application we will implement this interface to create our custom event.
The application will then be able to emit the event using the
javax.enterprise.event.Event class. The extension will also take care of writing the emitted events to our
outboxevent database table.
Task 5.3.2 - Inspect application properties
The configurations for the Reactive-Messaging and the Outbox Pattern are located in the quarkus configuration file
Have a look at the Quarkus Debezium Outbox pattern configuration.
This configuration will define the table and field names of our outbox table. For further details, please refer to the Debezium Outbox Quarkus Extension documentation.
Please take a note of the configuration
true). With disabling this our events stay in the outbox table forever. In theory there is no need to keep these persisted. Debezium will get the create event (row insert) from the WAL log. The provided
EventRouter is only sensible to create events. For debugging we have set this to
Now have a look at the reactive messaging configuration.
With this configuration our application will use a Kafka connector and will provide access to the messages using an incoming channel named
stock. This channel will contain events from both topics
To get more details about the concepts of Connectors and Channels you may head over to the SmallRye Reactive Messaging Documentation
Have a look at the snippet below which is used do consume the messages
If you want to know more about reactive messaging in quarkus have a look at the Quarkus Reactive Messaging Guide.