Friday, March 1, 2013


Publisher --> Exchanges binding to Queues --> Consumers

Direct Exchange

Direct exchange is often used to distribute tasks between workers but messages are load balanced between consumers and not between queues.

Messages can be persistent but this is per message and not related to whether the queue is durable or not.

Message attributes, content type, encoding, routing key, delivery mode, message priority, message publishing timestamp, expiration period, …

When does the Broker remove messages from the queue?
After broker sends a message to an application (using either basic.deliver or basic.get-ok AMQP methods)
After the application sends back an acknowledgement (using basic.ack AMQP method)
In the above statement if the message fails to deliver aka an acknowledgement was not received the message can be requeued and delivered to another consumer.

Remember with Queues you cannot redeclare a queue with different attributes other you will get a channel level exception code 406 (PRECONDITION_FAILED)

Channels in AMQP are "lightweight connections that share a single TCP connection", nice way to share between threads.

hcp125:~ randy$ rabbitmqctl list_exchanges
Listing exchanges ...
acmeExchange direct direct
amq.fanout fanout
amq.headers headers
amq.match headers
amq.rabbitmq.log topic
amq.rabbitmq.trace topic
amq.topic topic
dhcp125:~ randy$ rabbitmqadmin delete exchange name=acmeExchange
exchange deleted
dhcp125:~ randy$ rabbitmqadmin delete queue name=mathQueue

AMQP is extensible

Declaration of exchanges and queues can include additional attributes that the broker can use. For example, per-queue message TTL in RabbitMQ is implemented this way.

Two interesting reads on Rabbit Performance

1 comment: