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.

How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28

134 views

Published on

Talk of Serhiy Nazarov, founder QPARD, system architect, at Ruby Meditation #28 Kyiv 26.10.2019
Next conference - http://www.rubymeditation.com/
This presentation is connected with presentation How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28

Why we need a Rabbit? Let's try to cook it tasty. And what else? - Live demo of several useful dishes. Be ready to use Telegram to have fun with us.

Announcements and conference materials https://www.fb.me/RubyMeditation
News https://twitter.com/RubyMeditation
Photos https://www.instagram.com/RubyMeditation
The stream of Ruby conferences (not just ours) https://t.me/RubyMeditation

Published in: Software
  • Be the first to comment

  • Be the first to like this

How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28

  1. 1. How to cook Rabbit on Production Bohdan Parshencev Serhiy Nazarov
  2. 2. A long time ago, we started with a monolith...
  3. 3. What? Again?
  4. 4. I would tell you if it wasn't bullshit Benefits ● Quick Start ● Simple to develop ● Simple deploy Drawbacks ● Limitation in size and complexity ● New technology? No! Our way is the Legacy ASAP ● Difficult to scale ● Continuous deployment is difficult
  5. 5. Always start from monolith but
  6. 6. From monolith to microservices monolith Feature 2 Feature 1 Feature N Feature X
  7. 7. But again
  8. 8. Message broker
  9. 9. Benefits of service bus Better Performance Increased Reliability Granular Scalability Simplified Decoupling Rabbit MQ exchanges: ● Fanout ● Direct ● Topic ● Headers
  10. 10. Fanout Is it simple?
  11. 11. RabbitMQ routing Producer -> Exchanger Exchanger -> Queue Queue -> Consumer Exchanger -> Exchanger ● isolated space for sub system ● consolidate similar messages TOPIC Do you remember? ● Fanout ● Direct ● Topic ● Headers
  12. 12. Headers routing Routing key is absent We have a array of headers and can bind by any of them
  13. 13. Process Context Resource - Action - Context Resource - Process - State - [Context] User - Update - Start User - Update - Done User - Update - Done - Email Update - Done
  14. 14. Do you want a live demo? rm28.general rm28.space serhiy bohdan space resource: "message" speaker: "serhiy" resource: "question" -- speaker: "both" resource: "question" speaker: "bohdan" resource: "question" -- speaker: "both" resource: "question"
  15. 15. Send message with headers class RabbitPush class << self def call(speaker:, resource:, message:, from:) new.call(speaker, resource, message: message, from: from) end end def call(speaker, resource, payload) publish(payload, speaker: speaker, resource: resource) end private def publish(payload, **headers) exchange.publish( payload.to_json, headers: headers ) end def exchange puts "RABBITMQ_URL: #{ENV.fetch('RABBITMQ_URL')}" @@rabbit_connection ||= Bunny.new @@rabbit_connection.start @@rabbit_channel ||= @@rabbit_connection.create_channel @@exchange ||= @@rabbit_channel.headers("rm28.general", durable: true) end end
  16. 16. RPC remote procedure call
  17. 17. RPC RPC Call replay-to=anon-queue id=1 Replay routing-key=anon-queue id=1 S C RPC Exch Default Exch rpc-queue anon-queue
  18. 18. DEMO Your questions via Telegram bot
  19. 19. https://t.me/RubyMeditation28_bot
  20. 20. Example flow rm28.general rm28.space serhiy bohdan space resource: "message" speaker: "serhiy" resource: "question" -- speaker: "both" resource: "question" speaker: "bohdan" resource: "question" -- speaker: "both" resource: "question"

×