SmallRye Kafka is a Reactive Messaging connector for connecting Quarkus applications to Apache Kafka. It lets services publish and consume messages through named channels, such as an invoice-adjustment stream between Rental and Billing services. section 9.6 section 9.6.1
A typical Quarkus integration proceeds as follows:
- Add the Quarkus extension with `quarkus ext add quarkus-messaging-kafka`. section 9.6.1
- Inject an emitter for a channel, such as `@Channel("invoices-adjust") Emitter<InvoiceAdjust>`, then send domain messages from application logic. section 9.6.1
- Configure the channel with the `smallrye-kafka` connector so messages reach the Kafka topic. section 9.6.1
- Configure an outgoing channel when publishing confirmations, using `mp.messaging.outgoing.invoices-confirmations.connector=smallrye-kafka`. section 9.8.3
Publishing an invoice adjustment
The Rental service creates an `InvoiceAdjust` message containing the rental ID, user ID, actual end date, and adjusted price. Its emitter publishes the message to `invoices-adjust`; the connector serializes the object and sends it to Kafka, where Billing can consume it. section 9.6.1 section 9.6.1
Figure 9.8 The car rental architecture diagram detailing the Billing service integration
The architecture diagram shows the Rental and Billing service integration around the Kafka broker. section 9.6
