Getting Started
The easiest way to start using SmallRye Reactive Messaging is from Quarkus. SmallRye Reactive Messaging can also be used standalone, or with Open Liberty.
First, go to code.quarkus.io.
Select the smallrye-reactive-messaging
extension (already done if you use the link), and then click on the generate button to download the code.
One downloaded, unzip the project and import it in your IDE.
If you look at the pom.xml
file, you will see the following dependency:
It provides the support for SmallRye Reactive Messaging.
Ok, so far so good, but we need event-driven beans.
Create the quickstart
package, and copy the following class into it:
For instance:
This class contains a set of methods:
- producing messages (
source
) - processing messages (
toUpperCase
) - transforming the stream by skipping messages (
filter
) - consuming messages (
sink
)
Each of these methods are connected through channels.
Now, let's see this in action. For the terminal, run:
Running the previous example should give the following output:
Of course, this is a very simple example. To go further, let's have a look to the core concepts behind SmallRye Reactive Messaging.