0
Introduction to RabbitMQ
AlvaroVidela - Pivotal / RabbitMQ
Friday, September 13, 13
AlvaroVidela
• Developer Advocate at Pivotal / RabbitMQ
• Co-Author of RabbitMQ in Action
• Creator of the RabbitMQ Simula...
About Me
Co-authored
RabbitMQ in Action
http://bit.ly/rabbitmq
Friday, September 13, 13
Why do we
need messaging?
Friday, September 13, 13
Classic Web Apps
Friday, September 13, 13
Implement a
Photo Gallery
Friday, September 13, 13
Two Parts:
Friday, September 13, 13
Pretty Simple
Friday, September 13, 13
‘Till new
requirements arrive
Friday, September 13, 13
The Product Owner
Friday, September 13, 13
Can we also notify the user
friends when she uploads a new
image?
Friday, September 13, 13
Can we also notify the user
friends when she uploads a new
image?
I forgot to mention we need it for tomorrow…
Friday, Sep...
The Social Media Guru
Friday, September 13, 13
We need to give badges to
users for each picture upload
Friday, September 13, 13
We need to give badges to
users for each picture upload
and post uploads to Twitter
Friday, September 13, 13
The Sysadmin
Friday, September 13, 13
Dumb!You’re delivering full size
images!
The bandwidth bill has tripled!
Friday, September 13, 13
Dumb!You’re delivering full size
images!
The bandwidth bill has tripled!
We need this fixed for yesterday!
Friday, Septembe...
The Developer in the other
team
Friday, September 13, 13
I need to call your Java stuff but
from Python
Friday, September 13, 13
I need to call your Java stuff but
from Python
And also PHP starting next week
Friday, September 13, 13
The User
Friday, September 13, 13
I don’t want to wait
till your app resizes
my image!
Friday, September 13, 13
You
Friday, September 13, 13
(╯°□°)╯︵ ┻━┻
Friday, September 13, 13
Let’s see the
code evolution
Friday, September 13, 13
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Pseudo Code
...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Pseudo Code
...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Pseudo Code
...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Pseudo Code
...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
Pseudo Code
...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
image_handler:do_upload(ReqData:get_file()),
ok.
First Implem...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
{ok, Image} = image_handler:do_upload(ReqData:get_file()),
re...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
{ok, Image} = image_handler:do_upload(ReqData:get_file()),
re...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
{ok, Image} = image_handler:do_upload(ReqData:get_file()),
re...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
{ok, Image} = image_handler:do_upload(ReqData:get_file()),
re...
Can our code scale to new
requirements?
Friday, September 13, 13
What if
Friday, September 13, 13
• We need to speed up image conversion
What if
Friday, September 13, 13
• We need to speed up image conversion
• User notifications sent by email
What if
Friday, September 13, 13
• We need to speed up image conversion
• User notifications sent by email
• Stop tweeting about new images
What if
Friday, ...
• We need to speed up image conversion
• User notifications sent by email
• Stop tweeting about new images
• Resize in diff...
• We need to speed up image conversion
• User notifications sent by email
• Stop tweeting about new images
• Resize in diff...
Can we do better?
Friday, September 13, 13
Sure.
Using messaging
Friday, September 13, 13
Design
Publish / Subscribe Pattern
Friday, September 13, 13
%% image_controller
handle('PUT', "/user/image", ReqData) ->
{ok, Image} = image_handler:do_upload(ReqData:get_file()),
Ms...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
{ok, Image} = image_handler:do_upload(ReqData:get_file()),
Ms...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
{ok, Image} = image_handler:do_upload(ReqData:get_file()),
Ms...
%% image_controller
handle('PUT', "/user/image", ReqData) ->
{ok, Image} = image_handler:do_upload(ReqData:get_file()),
Ms...
Second Implementation:
Friday, September 13, 13
Second Implementation:
THIS PAGE INTENTIONALLY LEFT BLANK
Friday, September 13, 13
What is RabbitMQ
Friday, September 13, 13
RabbitMQ
Friday, September 13, 13
RabbitMQ
• Multi Protocol Messaging Server
Friday, September 13, 13
RabbitMQ
• Multi Protocol Messaging Server
• Open Source (MPL)
Friday, September 13, 13
RabbitMQ
• Multi Protocol Messaging Server
• Open Source (MPL)
• Polyglot
Friday, September 13, 13
RabbitMQ
• Multi Protocol Messaging Server
• Open Source (MPL)
• Polyglot
• Written in Erlang/OTP
Friday, September 13, 13
Multi Protocol
http://bit.ly/rmq-protocols
Friday, September 13, 13
Polyglot
Friday, September 13, 13
Polyglot
• Java
Friday, September 13, 13
Polyglot
• Java
• node.js
Friday, September 13, 13
Polyglot
• Java
• node.js
• Erlang
Friday, September 13, 13
Polyglot
• Java
• node.js
• Erlang
• PHP
Friday, September 13, 13
Polyglot
• Java
• node.js
• Erlang
• PHP
• Ruby
Friday, September 13, 13
Polyglot
• Java
• node.js
• Erlang
• PHP
• Ruby
• .Net
Friday, September 13, 13
Polyglot
• Java
• node.js
• Erlang
• PHP
• Ruby
• .Net
• Haskell
Friday, September 13, 13
Polyglot
Even COBOL!!!11
Friday, September 13, 13
Some users of RabbitMQ
Friday, September 13, 13
Some users of RabbitMQ
• Instagram
Friday, September 13, 13
Some users of RabbitMQ
• Instagram
• Indeed.com
Friday, September 13, 13
Some users of RabbitMQ
• Instagram
• Indeed.com
• MailboxApp
Friday, September 13, 13
Some users of RabbitMQ
• Instagram
• Indeed.com
• MailboxApp
• Mercado Libre
Friday, September 13, 13
Friday, September 13, 13
Messaging with RabbitMQ
A demo with the RabbitMQ Simulator
https://github.com/RabbitMQSimulator/RabbitMQSimulator
Friday, ...
Thanks
AlvaroVidela - @old_sound
Friday, September 13, 13
Upcoming SlideShare
Loading in...5
×

Introduction to RabbitMQ | Meetup at Pivotal Labs

2,370

Published on

The Pub/Sub Pattern image form slide 51 is taken from here: http://www.eaipatterns.com/PublishSubscribeChannel.html

Published in: Technology, Business

Transcript of "Introduction to RabbitMQ | Meetup at Pivotal Labs"

  1. 1. Introduction to RabbitMQ AlvaroVidela - Pivotal / RabbitMQ Friday, September 13, 13
  2. 2. AlvaroVidela • Developer Advocate at Pivotal / RabbitMQ • Co-Author of RabbitMQ in Action • Creator of the RabbitMQ Simulator • Blogs about RabbitMQ Internals: http://videlalvaro.github.io/internals.html • @old_sound | avidela@gopivotal.com github.com/videlalvaro Friday, September 13, 13
  3. 3. About Me Co-authored RabbitMQ in Action http://bit.ly/rabbitmq Friday, September 13, 13
  4. 4. Why do we need messaging? Friday, September 13, 13
  5. 5. Classic Web Apps Friday, September 13, 13
  6. 6. Implement a Photo Gallery Friday, September 13, 13
  7. 7. Two Parts: Friday, September 13, 13
  8. 8. Pretty Simple Friday, September 13, 13
  9. 9. ‘Till new requirements arrive Friday, September 13, 13
  10. 10. The Product Owner Friday, September 13, 13
  11. 11. Can we also notify the user friends when she uploads a new image? Friday, September 13, 13
  12. 12. Can we also notify the user friends when she uploads a new image? I forgot to mention we need it for tomorrow… Friday, September 13, 13
  13. 13. The Social Media Guru Friday, September 13, 13
  14. 14. We need to give badges to users for each picture upload Friday, September 13, 13
  15. 15. We need to give badges to users for each picture upload and post uploads to Twitter Friday, September 13, 13
  16. 16. The Sysadmin Friday, September 13, 13
  17. 17. Dumb!You’re delivering full size images! The bandwidth bill has tripled! Friday, September 13, 13
  18. 18. Dumb!You’re delivering full size images! The bandwidth bill has tripled! We need this fixed for yesterday! Friday, September 13, 13
  19. 19. The Developer in the other team Friday, September 13, 13
  20. 20. I need to call your Java stuff but from Python Friday, September 13, 13
  21. 21. I need to call your Java stuff but from Python And also PHP starting next week Friday, September 13, 13
  22. 22. The User Friday, September 13, 13
  23. 23. I don’t want to wait till your app resizes my image! Friday, September 13, 13
  24. 24. You Friday, September 13, 13
  25. 25. (╯°□°)╯︵ ┻━┻ Friday, September 13, 13
  26. 26. Let’s see the code evolution Friday, September 13, 13
  27. 27. %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Pseudo Code Comments Friday, September 13, 13
  28. 28. %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Pseudo Code Function Name Friday, September 13, 13
  29. 29. %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Pseudo Code Arguments Friday, September 13, 13
  30. 30. %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Pseudo Code Function Body Friday, September 13, 13
  31. 31. %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Pseudo Code ReturnValue Friday, September 13, 13
  32. 32. %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. First Implementation: Friday, September 13, 13
  33. 33. %% image_controller handle('PUT', "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), resize_image(Image), ok. Second Implementation: Friday, September 13, 13
  34. 34. %% image_controller handle('PUT', "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), resize_image(Image), notify_friends(ReqData:get_user()), ok. Third Implementation: Friday, September 13, 13
  35. 35. %% image_controller handle('PUT', "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), resize_image(Image), notify_friends(ReqData:get_user()), add_points_to_user(ReqData:get_user()), ok. Fourth Implementation: Friday, September 13, 13
  36. 36. %% image_controller handle('PUT', "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), resize_image(Image), notify_friends(ReqData:get_user()), add_points_to_user(ReqData:get_user()), tweet_new_image(User, Image), ok. Final Implementation: Friday, September 13, 13
  37. 37. Can our code scale to new requirements? Friday, September 13, 13
  38. 38. What if Friday, September 13, 13
  39. 39. • We need to speed up image conversion What if Friday, September 13, 13
  40. 40. • We need to speed up image conversion • User notifications sent by email What if Friday, September 13, 13
  41. 41. • We need to speed up image conversion • User notifications sent by email • Stop tweeting about new images What if Friday, September 13, 13
  42. 42. • We need to speed up image conversion • User notifications sent by email • Stop tweeting about new images • Resize in different formats What if Friday, September 13, 13
  43. 43. • We need to speed up image conversion • User notifications sent by email • Stop tweeting about new images • Resize in different formats • Swap Language / Technology (No Down Time) What if Friday, September 13, 13
  44. 44. Can we do better? Friday, September 13, 13
  45. 45. Sure. Using messaging Friday, September 13, 13
  46. 46. Design Publish / Subscribe Pattern Friday, September 13, 13
  47. 47. %% image_controller handle('PUT', "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), Msg = #msg{user = ReqData:get_user(), image = Image}, publish_message('new_image', Msg). First Implementation: Friday, September 13, 13
  48. 48. %% image_controller handle('PUT', "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), Msg = #msg{user = ReqData:get_user(), image = Image}, publish_message('new_image', Msg). First Implementation: %% friends notifier on('new_image', Msg) -> notify_friends(Msg.user, Msg.image). Friday, September 13, 13
  49. 49. %% image_controller handle('PUT', "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), Msg = #msg{user = ReqData:get_user(), image = Image}, publish_message('new_image', Msg). First Implementation: %% friends notifier on('new_image', Msg) -> notify_friends(Msg.user, Msg.image). %% points manager on('new_image', Msg) -> add_points(Msg.user, 'new_image'). Friday, September 13, 13
  50. 50. %% image_controller handle('PUT', "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), Msg = #msg{user = ReqData:get_user(), image = Image}, publish_message('new_image', Msg). First Implementation: %% friends notifier on('new_image', Msg) -> notify_friends(Msg.user, Msg.image). %% points manager on('new_image', Msg) -> add_points(Msg.user, 'new_image'). %% resizer on('new_image', Msg) -> resize_image(Msg.image). Friday, September 13, 13
  51. 51. Second Implementation: Friday, September 13, 13
  52. 52. Second Implementation: THIS PAGE INTENTIONALLY LEFT BLANK Friday, September 13, 13
  53. 53. What is RabbitMQ Friday, September 13, 13
  54. 54. RabbitMQ Friday, September 13, 13
  55. 55. RabbitMQ • Multi Protocol Messaging Server Friday, September 13, 13
  56. 56. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) Friday, September 13, 13
  57. 57. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) • Polyglot Friday, September 13, 13
  58. 58. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) • Polyglot • Written in Erlang/OTP Friday, September 13, 13
  59. 59. Multi Protocol http://bit.ly/rmq-protocols Friday, September 13, 13
  60. 60. Polyglot Friday, September 13, 13
  61. 61. Polyglot • Java Friday, September 13, 13
  62. 62. Polyglot • Java • node.js Friday, September 13, 13
  63. 63. Polyglot • Java • node.js • Erlang Friday, September 13, 13
  64. 64. Polyglot • Java • node.js • Erlang • PHP Friday, September 13, 13
  65. 65. Polyglot • Java • node.js • Erlang • PHP • Ruby Friday, September 13, 13
  66. 66. Polyglot • Java • node.js • Erlang • PHP • Ruby • .Net Friday, September 13, 13
  67. 67. Polyglot • Java • node.js • Erlang • PHP • Ruby • .Net • Haskell Friday, September 13, 13
  68. 68. Polyglot Even COBOL!!!11 Friday, September 13, 13
  69. 69. Some users of RabbitMQ Friday, September 13, 13
  70. 70. Some users of RabbitMQ • Instagram Friday, September 13, 13
  71. 71. Some users of RabbitMQ • Instagram • Indeed.com Friday, September 13, 13
  72. 72. Some users of RabbitMQ • Instagram • Indeed.com • MailboxApp Friday, September 13, 13
  73. 73. Some users of RabbitMQ • Instagram • Indeed.com • MailboxApp • Mercado Libre Friday, September 13, 13
  74. 74. Friday, September 13, 13
  75. 75. Messaging with RabbitMQ A demo with the RabbitMQ Simulator https://github.com/RabbitMQSimulator/RabbitMQSimulator Friday, September 13, 13
  76. 76. Thanks AlvaroVidela - @old_sound Friday, September 13, 13
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×