Chapter 15. Working with a Reactive Programming Model
We are all familiar with the client-server architecture that has dominated enterprise software development for decades. However, we have recently had a shift in architecture styles. In addition to the standard client-server approach, we have message-driven applications, microservices, reactive applications, and even serverless! All of these types of applications are possible to create using Quarkus. In the follow recipes, you’ll learn about reactive programming models, message buses, and streaming.
Note
Quarkus (and this book!) makes use of SmallRye Mutiny for its reactive library. You can read more about Mutiny at SmallRye Mutiny. There is also support for RxJava and Reactor, but they are not the preferred choice. To use either of them, you will need to use converters from Mutiny.
15.1 Creating Async HTTP Endpoints
Problem
You want to create an async HTTP endpoint.
Solution
Quarkus has integrations with Java Streams, the Eclipse MicroProfile Reactive spec, and SmallRye Mutiny.
These integrations make it easy to support an asynchronous HTTP endpoint.
The first thing you will need to do is determine which libraries you wish to use.
If you wish to use native Streams or the MicroProfile Reactive specification, you will need to add the quarkus-smallrye-reactive-streams-operators
extension.
If you want to use SmallRye Mutiny, add the quarkus-resteasy-mutiny
extension to your project.
Note
Going forward, Mutiny will be the preferred ...
Get Quarkus Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.