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.

RabbitMQ - message broker

499 views

Published on

RabbitMQ presentation with basics, dead letter exchange and remote procedure call.

Video record: https://www.youtube.com/watch?v=tkoDHoVOqz4

Published in: Technology
  • DOWNLOAD FULL. BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL. BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

RabbitMQ - message broker

  1. 1. RabbitMQ message broker
  2. 2. How it works
  3. 3. Producer • Also known as Publisher • Part of user application • Publishes messages to exchange (with routing key)
  4. 4. Exchange • Exchanges messages between producer and queues • Queue(s) selection depends on • Exchange type • Queue bindings • Routing key the message is published with
  5. 5. Exchange types • Direct - match exact routing keys • Topic - match pattern routing keys • Fanout - match all routing keys (ignores them) • Headers - match exact message headers (all or any)
  6. 6. Bindings • Also known as Routes • Connection between exchange and queue/exchange • Exchange can be bound to multiple queues • Queue can be bound to multiple exchanges • Exchange/Queue can be bound by multiple bindings
  7. 7. Direct routing
  8. 8. Direct routing • Example: ImageProcessorExchange • Image file path is sent in message body • ImageWatermarkQueue - `image.watermark` • Stores paths of images to watermark • Consumer applies watermark to images • ImageResizeQueue - `image.resize` • Stores paths of images to watermark • Consumer resizes images
  9. 9. Topic routing
  10. 10. Topic routing • Example: LoggerExchange <channel>.<log level> • FileLoggerQueue - `#` • Stores all message • Consumer logs message to file • SmsLoggerQueue - `*.critical`, `*.emergency` • Stores all critical and emergency messages • Consumer sends alert SMS to IT support phone
  11. 11. Fanout routing
  12. 12. Fanout routing • Example: OrderCreatedExchange • OrderCreatedSMSQueue • Consumer sends SMS message to customer • OrderCreatedMailQueue • Consumer sends mail to customer • OrderCreatedExportQueue • Consumer exports order to ERP system
  13. 13. Headers routing • Example: FileUploadExchange • Message with `format` header and file content in body • ImageUploadQueue - `format=jpeg`, `format=png` • Stores jpeg and png image files • Consumer resizes, applies watermark and saves image • VideoUploadQueue - `format=mp4`, `format=avi` • Stores mp4 and avi video files • Consumer resamples video to multiple resolutions • Another VideoResampleExchange can be used to faster resampling
  14. 14. Queue • FIFO - first in first out • Stores messages until consumed by consumer • Every queue is bind to default exchange • Queue name is used as routing key • Can be used for Dead Letter Exchange or RPC
  15. 15. Consumer • Part of user application • Consumes messages from queue • Needs to acknowledge message • Only if the message’s delivery mode is persistent • Multiple instances can be used for faster processing
  16. 16. Message acknowledgement • Acknowledge • Reject • Drop • Re-queue (infinite loops may occur) • Use Dead Letter Exchange instead
  17. 17. Questions? we are not finished yet
  18. 18. Dead Letter Exchange DLX
  19. 19. Dead Letter Exchange • Allows safe rejecting messages • not using re-queue (infinite loops) • moves them to another queue • Move messages back after you fix issue causing reject • Messages can be moved back automatically after delay
  20. 20. Dead Letter Exchange • While declaring queue `queue.one` use arguments • x-dead-letter-exchange: `` //default exchange • x-dead-letter-routing-key: `queue.one.dlx` • Declare additional queue `queue.one.dlx` • Now every time message from `queue.one` is rejected (without re-queue) it is automatically dead lettered to `queue.one.dlx`.
  21. 21. Dead Letter Exchange • To automatically move messages back to original queue you need to declare `queue.one.dlx` with dead letter arguments routing back to original queue • Now when `queue.one.dlx` message is rejected it will be moved back to queue `queue.one` • To automatically reject message after delay declare queue `queue.one.dlx` with argument `x-message-ttl`. As value use timeout in milliseconds
  22. 22. Remote Procedure Call RPC
  23. 23. Remote Procedure Call • Sometimes you need to wait for response • Useful for multiple (time consuming) calculations at same time • 10s and 15s calculations will last 15s instead of 25s
  24. 24. Remote Procedure Call • RPC client (Publisher) • generates temporary queue • publishes message to RPC server’s exchange • with generated queue name in message header • starts consuming generated queue (timeout is recommended)
  25. 25. Remote Procedure Call • RPC server (Consumer) • processes message from RPC client • publishes response to default exchange • using generated queue name from message header as routing key
  26. 26. Questions?
  27. 27. Thanks! Vít Kutný https://vitkutny.cz

×