Skip to main content

Messaging Model

Apache Artemis messaging model is built on top of three main concepts: addresses, queues and routing types.

Address

The general idea behind the messaging model of Apache Artemis is that producers never send messages directly to queues. Actually, a producer is unaware whether a message will be delivered to any queue at all. Instead, the producer can only send messages to an address. The address represents a message endpoint. It receives messages from producers and pushes them to queues. The address knows exactly what to do with the message it receives. Should it be appended to a single or to many queues? Or maybe should it be discarded. The rules for that are defined by the routing type.

Routing Types

There are two routing types available in Apache Artemis: Anycast and Multicast. The address can be created with either or both routing types.

When the address was created with Anycast routing type all messages send to this address will be evenly distributed1 among all the queues attached to this address. With Multicast routing type every queue bound to the address receives its very own copy of a message. Had the message been pushed to the queue, it can be picked up by one of the consumers attached to this particular queue.

Further Reading

The Apache Artemis address model is described in detail (with examples using ArtemisNetClient) in this article.

If you use the dependency injection package, the same address, queue, and routing concepts show up in AddConsumer, AddProducer, and topology declaration APIs. See Dependency Injection for the ASP.NET Core registration flow.

Footnotes:

Footnotes

  1. Messages will be distributed using Round-robin distribution algorithm.