2. What is AMQP?
AMQP (Advanced Message
Queuing Protocol) is a
networking protocol that enables
conforming client applications to
communicate with conforming
messaging middleware brokers.
3. WHAT ARE
BROKERS
Messaging brokers receive
messages from publishers
(applications that publish them,
also known as producers) and
route them to consumers
(applications that process them).
4. EXAMPLE OF
BROKERS
• RabbitMQ (by VMWARE)!
• Microsoft's Windows Azure
Service Bus!
• Red Hat Enterprise MRG!
• StormMQ
5. Lorem Ipsum Dolor
RABBITMQ Open Source message
broker / queueing system
written in Erlang
implementing AMQP
6. Who Uses AMQP
• JPMorgan - 1 billion AMQP messages per day; used in
dozens of mission critical systems worldwide!
• VMware - Makes extensive use of RabbitMQ in its
virtualization products and cloud service!
• Google!
• UIDAI, Government of India - the largest online
identity project in the world aiming to provide each of
India's 1.2 billion residents with a unique identity
number!
• AT&T, Smith Electric Vehicles, Mozilla, RED HAT cloud
services
15. Lorem Ipsum Dolor
AMQP-MODEL
• messages can be anything,!
plain text, json, bytes, etc.!
• Publisher and Consumer
are typically decoupled in
big apps
16. Exchanges and
Exchange Types
• Direct exchange - specific
routing key!
• Fanout exchange - braodcast!
• Topic exchange - regex style
routing key!
• Headers exchange
19. Lorem Ipsum Dolor
FAN-OUT
• leaderboard updates or other
global events!
• Sport news sites can use score
updates to mobile clients in near
real-time!
• Group chats can distribute
messages between participants
20. Lorem Ipsum Dolor
TOPIC
EXCHANGE
• delimeter is dots!
• * = 1!
• # = anything
21. USING BUNNY
require “bunny”!
#connect to rabbitmq!
conn = Bunny.new!
conn.start!
#create channel!
channel = conn.create_channel!
#create / subscribe to a queue!
queue = ch.queue(“hello”)!
exchange = ch.default_exchange!
#bind queue to an exchange!
queue.bind(exchange, :routing_key =>
severity)
exchange.publish("Hello
World!", :routing_key => queue.name)
queue.subscribe(:block => true) do |
delivery_info, properties, body|!
puts " [x] Received #{body}"!
!
# cancel the consumer to exit!
delivery_info.consumer.cancel!
end