AMQP 0-9-1 Overview
- The AMQP Protocol
- Connections & Channels
- Publishers and Consumers
More Exchange Types
More Consumer Features
Reliable Message Delivery
High Availability and Backup
Management HTTP API
LavinMQ allows a lot of flexibility. A lot of this flexibility is in the bindings and how it is defined by the routing key, headers, and the type of exchange. A binding is an association or relation between a queue and an exchange. It describes which queue is interested in messages from a given exchange.
What is a binding?
A binding is an association or relation between a queue and an exchange. A queue tells the exchange that it is interested in messages from the given exchange, given some directives in the routing key on the binding and headers.
Bindings between queues and exchanges
Bindings are rules that exchanges use to route messages to queues. A queue must be bound to at least one exchange in order to receive messages from publishers.
Code example in Python, Pika:
Bindings can take an extra parameter called routing key. A routing key can also be sent with a message. The routing key on the binding is sometimes called a binding key. The routing key in the message is what the exchange is looking at while delivering messages.
Code example with routing key in Python, Pika:
Read more about how different exchanges are using routing keys.
In the header exchange, a special argument named
x-match, added in the binding
between exchange and queue, specifies if all headers must match or just one.
Either any common header between the message and the binding count as a match,
or all the headers referenced in the binding need to be present in the message
for it to match.
x-match property can have two different values:
all is the default value. A value of
all means all header pairs (key, value)
must match, while a value of
any means at least one of the header pairs must
match. Headers can be constructed using a wider range of data types, integer or
hash for example, instead of a string. The headers exchange type (used with the
any) is useful for directing messages which contain a
subset of known (unordered) criteria.
Code example in Ruby (bunny):
Ready to take the next steps? Here are some things you should keep in mind:
Managed LavinMQ instance on CloudAMQP
LavinMQ has been built with performance and ease of use in mind - we've benchmarked a throughput of about 1,000,000 messages/sec. You can try LavinMQ without any installation hassle by creating a free instance on CloudAMQP. Signing up is a breeze.