Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Asynchronous - decoupling applications by separating sending and 
receiving data 
Reliability - persistence, delivery ackn...
Producing - means just sending. A program that sends 
messages is a producer. 
Queue is the name for a mailbox. It lives i...
So RabbitMQ just accepts messages from producers, and 
delivers them to consumers 
But it can also route, buffer, and pers...
Let’s try it
Queues 
A worker process running in the background will pop the tasks 
and eventually execute the job 
Made for easily par...
Message acknowledgments 
Once RabbitMQ delivers a message to the customer it 
immediately removes it from memory 
But what...
• ack is disabled by default, you can enable it like this: 
:manual_ack => true 
•Message durability 
ch.queue("hello", :d...
Exchanges 
The core idea in the messaging model in RabbitMQ is that the 
producer never sends any messages directly to a q...
Direct exchange 
The routing algorithm behind a direct exchange is simple - a 
message goes to the queues whose binding ke...
Topic Exchanges 
Topic exchanges route messages to one or many queues 
based on matching between a message routing key and...
Fanout exchange 
It just broadcasts all the messages it receives to all the queues 
it knows
Headers exchanges 
q1 = ch.queue("", :exclusive => true).bind(x, :arguments => 
{"os" => "linux", "cores" => 8, "x-match" ...
Bindings 
Relationship between exchange and a queue is called a 
binding 
queue.bind("exchange") 
This can be simply read ...
Rabbitmq basics
Upcoming SlideShare
Loading in …5
×

Rabbitmq basics

987 views

Published on

Slide from my talk about RabbitMQ basics

Published in: Software
  • Be the first to comment

Rabbitmq basics

  1. 1. Asynchronous - decoupling applications by separating sending and receiving data Reliability - persistence, delivery acknowledgements, publisher confirms, and high availability Flexible Routing - messages are routed through exchanges before arriving at queues Highly Available Queues - queues can be mirrored across several machines in a cluster Multi-protocol - RabbitMQ supports messaging over a variety of messaging protocols Many Clients - there are RabbitMQ clients for almost any language Management UI - RabbitMQ ships with an easy-to use management UI Plugin System - RabbitMQ ships with a variety of plugins extending it in different ways, and you can also write your own.
  2. 2. Producing - means just sending. A program that sends messages is a producer. Queue is the name for a mailbox. It lives inside RabbitMQ. Messages can be stored only inside a queue. Consuming - receiving. A consumer is a program that mostly waits to receive messages.
  3. 3. So RabbitMQ just accepts messages from producers, and delivers them to consumers But it can also route, buffer, and persist the messages according to rules you give it.
  4. 4. Let’s try it
  5. 5. Queues A worker process running in the background will pop the tasks and eventually execute the job Made for easily parallelise work. We can add more workers at any time and that way, scale easily Let’s see how it works
  6. 6. Message acknowledgments Once RabbitMQ delivers a message to the customer it immediately removes it from memory But what will happened if the message goes to worker and will not process correctly? An ack(nowledgement) is sent back from the consumer to tell RabbitMQ that a particular message has been received, processed and that RabbitMQ is free to delete it.
  7. 7. • ack is disabled by default, you can enable it like this: :manual_ack => true •Message durability ch.queue("hello", :durable => true) •Fair dispatch ch.prefetch(1)
  8. 8. Exchanges The core idea in the messaging model in RabbitMQ is that the producer never sends any messages directly to a queue, it’s send it to exchanges • direct, • topic • headers • fanout sudo rabbitmqctl list_exchanges
  9. 9. Direct exchange The routing algorithm behind a direct exchange is simple - a message goes to the queues whose binding key exactly matches the routing key of the message
  10. 10. Topic Exchanges Topic exchanges route messages to one or many queues based on matching between a message routing key and the pattern that was used to bind a queue to an exchange. The topic exchange type is often used to implement various publish/subscribe pattern variations. * (star) can substitute for exactly one word. # (hash) can substitute for zero or more words.
  11. 11. Fanout exchange It just broadcasts all the messages it receives to all the queues it knows
  12. 12. Headers exchanges q1 = ch.queue("", :exclusive => true).bind(x, :arguments => {"os" => "linux", "cores" => 8, "x-match" => "all"}) x.publish("8 cores/Linux", :headers => {"os" => "linux", "cores" => 8})
  13. 13. Bindings Relationship between exchange and a queue is called a binding queue.bind("exchange") This can be simply read as: the queue is interested in messages from this exchange

×