# Exchanges

An Exchange is a named entity within the Virtual Host which receives messages from producers and routes them to matching message Queues within the Virtual Host. Message routing occurs based on the particular Exchange's routing algorithm and its configured queue Bindings.

The following Exchange types are supported by the Broker:

- Direct: routes messages to queues based on an exact match between the routing key of the message, and the binding key used to bind the queue to the exchange

- Topic: routes messages to queues based on heirarchical pattern matching between the routing key for each message and the binding keys used to bind Queues to the Exchange. This exchange type is used to support the classic publish/subscribe paradigm using a topic namespace as the addressing model to select and deliver messages across multiple consumers based on a partial or full match on a topic pattern.

  Binding and routing keys for this Exchange use a "." deliminator to seperate words representing different levels of the heirarchy, with special meaning given to use of * and # as a word within a binding key such that a * matches any single word in a routing key and # matches zero or more words, allowing a binding key to match many routing keys for published messages. For example, a binding key of a.b.# would match the routing keys a.b, a.b.c, and a.b.c.d, but not the routing key a.z.

- Fanout: routes messages to all queues bound to the exchange, regardless of the message's routing key.

- Headers: routes messages to queues based on header properties within the AMQP message. The message is passed to a queue if the header properties of the message satisfy header matching arguments table with which the queue was bound.

Also, Broker supports the concept of a Default Exchange to which all queues are bound using their name as a binding key.

Any number of exchanges of any type can be created on Virtual Host.

Exchange configuration is covered in .