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.

AMQP

860 views

Published on

Published in: Technology
  • Be the first to comment

AMQP

  1. 1. • Message queueing• AMQP (Advanced Message Queueing Protocol)• Broker implementations• Use cases
  2. 2. • Message queueing• AMQP (Advanced Message Queueing Protocol)• Broker implementations• Use cases
  3. 3. Introduction to Messaging Message Queueing
  4. 4. Why messaging? Messaging• Get data from point A to point B• Decouple publishers and consumers• Queueing for later delivery• Asynchronous• Load balancing and scalability
  5. 5. Definition Message queues• are software-engineering components used for interprocess communication• provide an asynchronous communications protocol• have implicit or explicit limits on the size of data that may be transmitted in a single message
  6. 6. The main features Message queueing• There are no direct connection between programs• Communication between programs can be time- independent• Work can be out by small, self-contained programs• Communication can be driven by events• Application can assign a priority to a message• Security• Data integrity• Recovery support
  7. 7. AMQP Advanced Message Queueing Protocol
  8. 8. Why? AMQP• Broadly applicable for enterprise• Totally open• Platform agnostic• Interoperable
  9. 9. Protocol AMQP• Network wire-level protocol o Defines how clients and brokers talk o Data serialization (framing), heartbeat o Hidden inside client libraries• AMQP model o Defines routing and storing of messages o Defines rules how these are wired together o Exported API
  10. 10. AboutNetwork wire-level protocol• Information is organized into "frames"• Independent threads of control within a single socket connection are called "channels"• For each channel, frames run in sequence• Each frame consists of header, payload, frame end packet• Frames can be protocol methods, structured content (message headers), data
  11. 11. ModelAMQP
  12. 12. Why?Virtual hosts• Created for administrative purposes• Access control• Each connection (and all channels inside) must be associated with a single virtual host• Each virtual host comprises its own name space, a set of exchanges, message queues and all associated objects
  13. 13. DefinitionExchange• A message routing agent• Can be durable - lasts till explicitly deleted• Can be temporary - lasts till server shuts down• Can be auto-deleted - lasts till no longer used• There are several types of exchanges, each implements a particular algorythm• Each message is delivered to each qualifying queue• "Binding" - a link between queue and exchange
  14. 14. Definition Direct exchange type• Uses string as routing key• Queue binds to exchange with key K• Publisher sends message with key R• Message is passed to this queue if K = R• Direct exchange named "amq.direct" is always pre-created in each virtual host
  15. 15. RoutingDirect exchange
  16. 16. Definition Fanout exchange type• No routing key• What goes in must go out• Can be used for load balancing
  17. 17. RoutingFanout exchange
  18. 18. Definition Topic exchange type• Uses pattern as routing key ("a.b.c.d")• Queues can use wildcard characters binding• * matches a single word, # - zero or more• "amq.topic" is pre-created in each vhost• *.stock.# matches usd.stock and eur.stock.db but not stock.nasdaq
  19. 19. RoutingTopic exchange
  20. 20. Details Message queue• named "weak FIFO" buffer• FIFO is guaranteed only with 1 consumer• Can be durable, temporary (private to 1 consumer) or auto-deleted• A message queue routed to queue is never sent to more than one client unless it is being resent after failure or rejection• You can get server to auto generate and assign queue name for your queue - this is usually done for private queues
  21. 21. About Messages• Message is atomic unit of processing• Can be persistent (delivery guarantee in case network failure or server crash)• Can have a priority level
  22. 22. Message contentMessages• Messages carry content (header + body)• Content body is opaque block of binary data• Broker never modifies content body• AMQP defines several "content classes", each with specific syntax (which headers can be used) and semantics (which methods are available for such messages)
  23. 23. Thank you for attention by Karlen Kishmiryan (Sourcio CJSC)

×