Saturday, January 5, 2019

The Basics of RMQ

What is an Exchange?
  -Exchange works like a message routing agent, responsible for  routing the message to queue.
  -Publisher  sends the message to exchange.
  -Exchange deliver the messages based on the header attributes, binding and routing keys.
- Publisher can send messages directly to exchange with declaring the routing key. No need to bind with any queue specifically.
- Exchange can be declared programmatically  from the connection template(RabbitMQTemplate)

Exchange types:
  -temporary, durable, auto-delete
 -Clients can can use predefined  default exchange or create a new one.
 -Exchange created when the server starts.

Direct exchange:
Topic exchanges route messages to queues based on wildcard matches between the routing key and something called the routing patternHere a message goes to the queues whose binding key exactly matches the routing key of the message.

Topic Exchange specified by the queue binding. Messages are routed to one or many queues based on a matching between a message routing key and this pattern.

Fanout Exchange
The fanout copies and routes a received message to all queues that are bound to it regardless of routing keys or pattern matching as with direct and topic exchanges. Keys provided will simply be ignored.

Virtual Hosts:
AMQP provide isolated environment in which the messages entities (exchange/queue/users/...) live. This allows one broker to have multiple hosts similar to webs servers.

Channels:
 Channels are the next protocol layer on top of Connections. Our application uses it to communicate with the RabbitMQ server.

No comments:

Post a Comment