RabbitMQ Hands On                              Álvaro Videla - VMwareMonday, February 25, 13
About Me                    •     Developer Advocate for Cloud Foundry                    •     Blog: http://videlalvaro.g...
About Me                    •     Developer Advocate for Cloud Foundry                    •     Blog: http://videlalvaro.g...
About Me                          Co-authored               RabbitMQ in Action              http://bit.ly/rabbitmqMonday, ...
Why do you                          need messaging?Monday, February 25, 13
Classic Web AppsMonday, February 25, 13
Implement a                          Photo GalleryMonday, February 25, 13
Two Parts:Monday, February 25, 13
Pretty SimpleMonday, February 25, 13
‘Till new                          requirements arriveMonday, February 25, 13
The Product OwnerMonday, February 25, 13
Can we also notify the                    user friends when she                    uploads a new image?Monday, February 25...
Can we also notify the                    user friends when she                    uploads a new image?      I forgot to m...
Monday, February 25, 13
The Social Media GuruMonday, February 25, 13
We need to give badges                  to users for each                   picture uploadMonday, February 25, 13
We need to give badges                  to users for each                   picture upload                          and po...
Monday, February 25, 13
The SysadminMonday, February 25, 13
Dumb! You’re delivering                    full size images!                 The bandwidth bill has                       ...
Dumb! You’re delivering                    full size images!                 The bandwidth bill has                       ...
Monday, February 25, 13
The Developer in the                              other teamMonday, February 25, 13
I need to call your PHP                   stuff but from PythonMonday, February 25, 13
I need to call your PHP                   stuff but from Python                          And also Java starting next weekM...
Monday, February 25, 13
The UserMonday, February 25, 13
I don’t want to wait                          till your app resizes                                my image!Monday, Februa...
YouMonday, February 25, 13
Monday, February 25, 13
Let’s see the                          code evolutionMonday, February 25, 13
Pseudo Code                                Comments            %% image_controller            handle(PUT, "/user/image", R...
Pseudo Code                              Function Name            %% image_controller            handle(PUT, "/user/image"...
Pseudo Code                                Arguments            %% image_controller            handle(PUT, "/user/image", ...
Pseudo Code                              Function Body            %% image_controller            handle(PUT, "/user/image"...
Pseudo Code                               Return Value            %% image_controller            handle(PUT, "/user/image"...
First Implementation:            %% image_controller            handle(PUT, "/user/image", ReqData) ->              image_...
Second Implementation:            %% image_controller            handle(PUT, "/user/image", ReqData) ->              {ok, ...
Third Implementation:            %% image_controller            handle(PUT, "/user/image", ReqData) ->              {ok, I...
Fourth Implementation:            %% image_controller            handle(PUT, "/user/image", ReqData) ->              {ok, ...
Final Implementation:            %% image_controller            handle(PUT, "/user/image", ReqData) ->              {ok, I...
Can our code scale to                      new requirements?Monday, February 25, 13
What ifMonday, February 25, 13
What if                • We need to speed up image conversionMonday, February 25, 13
What if                • We need to speed up image conversion                • User notifications sent by emailMonday, Febr...
What if                • We need to speed up image conversion                • User notifications sent by email            ...
What if                • We need to speed up image conversion                • User notifications sent by email            ...
What if                • We need to speed up image conversion                • User notifications sent by email            ...
Can we do better?Monday, February 25, 13
Sure.                          Using messagingMonday, February 25, 13
Design                          Publish / Subscribe PatternMonday, February 25, 13
First Implementation:            %% image_controller            handle(PUT, "/user/image", ReqData) ->              {ok, I...
First Implementation:            %% image_controller            handle(PUT, "/user/image", ReqData) ->              {ok, I...
First Implementation:            %% image_controller            handle(PUT, "/user/image", ReqData) ->              {ok, I...
First Implementation:            %% image_controller            handle(PUT, "/user/image", ReqData) ->              {ok, I...
Second Implementation:Monday, February 25, 13
Second Implementation:                          THIS PAGE INTENTIONALLY LEFT BLANKMonday, February 25, 13
Monday, February 25, 13
Messaging and                           RabbitMQMonday, February 25, 13
RabbitMQMonday, February 25, 13
RabbitMQ                 • Multi Protocol Messaging ServerMonday, February 25, 13
RabbitMQ                 • Multi Protocol Messaging Server                 • Open Source (MPL)Monday, February 25, 13
RabbitMQ                 • Multi Protocol Messaging Server                 • Open Source (MPL)                 • Part of S...
RabbitMQ                 • Polyglot                 • Multi Protocol                 • Open Source (MPL)                 •...
Multi Protocol                     http://bit.ly/rmq-protocolsMonday, February 25, 13
Polyglot                • PHP                • node.js                • Erlang                • Java                • Ruby...
TELL ME MOREMonday, February 25, 13
CODE OR IT                          DIDN’T HAPPEN                     http://github.com/videlalvaro/php-amqplibMonday, Feb...
MessagingMonday, February 25, 13
Scale                          MessagingMonday, February 25, 13
Scale         Decoupling                          MessagingMonday, February 25, 13
Scale                Decoupling                          Messaging                          Polyglot AppsMonday, February ...
Questions?Monday, February 25, 13
Thanks!                          @old_soundMonday, February 25, 13
Upcoming SlideShare
Loading in …5
×

RabbitMQ Hands On

7,891 views

Published on

Talk given at PHPUK 13.

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

Published in: Technology

RabbitMQ Hands On

  1. RabbitMQ Hands On Álvaro Videla - VMwareMonday, February 25, 13
  2. About Me • Developer Advocate for Cloud Foundry • Blog: http://videlalvaro.github.com/ • Twitter: @old_soundMonday, February 25, 13
  3. About Me • Developer Advocate for Cloud Foundry • Blog: http://videlalvaro.github.com/ • Twitter: @old_sound • I created gifsockets™Monday, February 25, 13
  4. About Me Co-authored RabbitMQ in Action http://bit.ly/rabbitmqMonday, February 25, 13
  5. Why do you need messaging?Monday, February 25, 13
  6. Classic Web AppsMonday, February 25, 13
  7. Implement a Photo GalleryMonday, February 25, 13
  8. Two Parts:Monday, February 25, 13
  9. Pretty SimpleMonday, February 25, 13
  10. ‘Till new requirements arriveMonday, February 25, 13
  11. The Product OwnerMonday, February 25, 13
  12. Can we also notify the user friends when she uploads a new image?Monday, February 25, 13
  13. Can we also notify the user friends when she uploads a new image? I forgot to mention we need it for tomorrow…Monday, February 25, 13
  14. Monday, February 25, 13
  15. The Social Media GuruMonday, February 25, 13
  16. We need to give badges to users for each picture uploadMonday, February 25, 13
  17. We need to give badges to users for each picture upload and post uploads to TwitterMonday, February 25, 13
  18. Monday, February 25, 13
  19. The SysadminMonday, February 25, 13
  20. Dumb! You’re delivering full size images! The bandwidth bill has tripled!Monday, February 25, 13
  21. Dumb! You’re delivering full size images! The bandwidth bill has tripled! We need this fixed for yesterday!Monday, February 25, 13
  22. Monday, February 25, 13
  23. The Developer in the other teamMonday, February 25, 13
  24. I need to call your PHP stuff but from PythonMonday, February 25, 13
  25. I need to call your PHP stuff but from Python And also Java starting next weekMonday, February 25, 13
  26. Monday, February 25, 13
  27. The UserMonday, February 25, 13
  28. I don’t want to wait till your app resizes my image!Monday, February 25, 13
  29. YouMonday, February 25, 13
  30. Monday, February 25, 13
  31. Let’s see the code evolutionMonday, February 25, 13
  32. Pseudo Code Comments %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Monday, February 25, 13
  33. Pseudo Code Function Name %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Monday, February 25, 13
  34. Pseudo Code Arguments %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Monday, February 25, 13
  35. Pseudo Code Function Body %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Monday, February 25, 13
  36. Pseudo Code Return Value %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Monday, February 25, 13
  37. First Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok.Monday, February 25, 13
  38. Second Implementation: %% image_controller handle(PUT, "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), resize_image(Image), ok.Monday, February 25, 13
  39. Third Implementation: %% 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.Monday, February 25, 13
  40. Fourth Implementation: %% 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.Monday, February 25, 13
  41. Final Implementation: %% 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.Monday, February 25, 13
  42. Can our code scale to new requirements?Monday, February 25, 13
  43. What ifMonday, February 25, 13
  44. What if • We need to speed up image conversionMonday, February 25, 13
  45. What if • We need to speed up image conversion • User notifications sent by emailMonday, February 25, 13
  46. What if • We need to speed up image conversion • User notifications sent by email • Stop tweeting about new imagesMonday, February 25, 13
  47. What if • We need to speed up image conversion • User notifications sent by email • Stop tweeting about new images • Resize in different formatsMonday, February 25, 13
  48. What if • 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)Monday, February 25, 13
  49. Can we do better?Monday, February 25, 13
  50. Sure. Using messagingMonday, February 25, 13
  51. Design Publish / Subscribe PatternMonday, February 25, 13
  52. First Implementation: %% 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).Monday, February 25, 13
  53. First Implementation: %% 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). %% friends notifier on(new_image, Msg) -> notify_friends(Msg.user, Msg.image).Monday, February 25, 13
  54. First Implementation: %% 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). %% friends notifier on(new_image, Msg) -> notify_friends(Msg.user, Msg.image). %% points manager on(new_image, Msg) -> add_points(Msg.user, new_image).Monday, February 25, 13
  55. First Implementation: %% 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). %% 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).Monday, February 25, 13
  56. Second Implementation:Monday, February 25, 13
  57. Second Implementation: THIS PAGE INTENTIONALLY LEFT BLANKMonday, February 25, 13
  58. Monday, February 25, 13
  59. Messaging and RabbitMQMonday, February 25, 13
  60. RabbitMQMonday, February 25, 13
  61. RabbitMQ • Multi Protocol Messaging ServerMonday, February 25, 13
  62. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL)Monday, February 25, 13
  63. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) • Part of Spring SourceMonday, February 25, 13
  64. RabbitMQ • Polyglot • Multi Protocol • Open Source (MPL) • Written in Erlang/OTPMonday, February 25, 13
  65. Multi Protocol http://bit.ly/rmq-protocolsMonday, February 25, 13
  66. Polyglot • PHP • node.js • Erlang • Java • Ruby • .Net • HaskellMonday, February 25, 13
  67. TELL ME MOREMonday, February 25, 13
  68. CODE OR IT DIDN’T HAPPEN http://github.com/videlalvaro/php-amqplibMonday, February 25, 13
  69. MessagingMonday, February 25, 13
  70. Scale MessagingMonday, February 25, 13
  71. Scale Decoupling MessagingMonday, February 25, 13
  72. Scale Decoupling Messaging Polyglot AppsMonday, February 25, 13
  73. Questions?Monday, February 25, 13
  74. Thanks! @old_soundMonday, February 25, 13

×