SmallRye Reactive Messaging implements MicroProfile Reactive Messaging in Quarkus. It controls asynchronous message flow through application channels and adds features beyond the specification, including broadcast and connectors for external messaging systems. Messaging integrations can also use blocking APIs. section 9.10 section 9.3.2
A CDI bean produces messages with @Outgoing, consumes them with @Incoming, or processes them with both. A channel ordinarily has one producer and one consumer; processors use distinct channel names to establish their order. SmallRye can additionally broadcast messages from one channel to multiple consumers. Reactive methods can use Mutiny’s Multi, a Publisher subtype. section 9.3.2
From an in-memory flow to a broker
An @Outgoing("ticks") method emits five ticks one second apart. A processor turns them into timestamps on the times channel, where an @Incoming consumer prints them. To connect services through a broker, add a connector extension: smallrye-kafka for Kafka or quarkus-messaging-rabbitmq for RabbitMQ. The same channel-based API applies to in-memory and remote messaging, so moving an existing flow to RabbitMQ requires limited application changes. section 9.3.2 section 9.6 section 9.7
For RabbitMQ, an invoices producer can inject @Channel("invoices") MutinyEmitter<Invoice>, while a Billing service consumes from @Incoming("invoices-rabbitmq"). Configuration maps the incoming channel to the invoices exchange and queue. Connector extensions provide Dev Services that start brokers and connect applications in Dev mode; those development conveniences do not replace deliberate broker configuration outside Dev mode. section 9.7 section 9.10
Listing 9.1 MicroProfile Reactive Messaging with Mutiny example
@Outgoing("ticks")
public Multi<Long> aFewTicks() {
return Multi.createFrom()
.ticks().every(Duration.ofSeconds(1))
.select().first(5);
}
@Incoming("ticks")
@Outgoing("times")
public Multi<String> processor(Multi<Long> ticks) {
return ticks.map(tick -> Instant.now().toString());
}
@Incoming("times")
public void consumer(String payload) {
System.out.println(payload);
}
The complete ticks-to-times listing shows a Mutiny producer, processor, and consumer connected by annotated channels. section 9.3.2
