SlideShare a Scribd company logo
Cloud Messaging with
                           Cloud Foundry
                           Álvaro Videla - VMware




                           © 2012 VMware, Inc. All rights reserved.
Tuesday, November 13, 12
About Me


                • Developer Advocate for Cloud Foundry
                • Blog: http://videlalvaro.github.com/
                • Twitter: @old_sound




                                                         2
Tuesday, November 13, 12
About Me


                •   Developer Advocate for Cloud Foundry
                •   Blog: http://videlalvaro.github.com/
                •   Twitter: @old_sound
                •   I created gifsockets™




                                                           3
Tuesday, November 13, 12
About Me



            Co-authored

            RabbitMQ in Action




              http://bit.ly/rabbitmq




                                       4
Tuesday, November 13, 12
Classic Apps



                                          5
Tuesday, November 13, 12
Implement a
                           Photo Gallery


Tuesday, November 13, 12
Two Parts:




Tuesday, November 13, 12
Pretty Simple



Tuesday, November 13, 12
‘Till new
                           requirements arrive


Tuesday, November 13, 12
The Product Owner



Tuesday, November 13, 12
Can we also notify the
                   user friends when she
                   uploads a new image?


Tuesday, November 13, 12
Can we also notify the
                   user friends when she
                   uploads a new image?
      I forgot to mention we need it for tomorrow…

Tuesday, November 13, 12
Tuesday, November 13, 12
The Social Media Guru



Tuesday, November 13, 12
We need to give badges
                  to users for each
                   picture upload


Tuesday, November 13, 12
We need to give badges
                  to users for each
                   picture upload
                           and post uploads to Twitter

Tuesday, November 13, 12
Tuesday, November 13, 12
The Sysadmin



Tuesday, November 13, 12
Dumb! You’re delivering
                   full size images!
                The bandwidth bill has
                        tripled!

Tuesday, November 13, 12
Dumb! You’re delivering
                   full size images!
                The bandwidth bill has
                        tripled!
                           We need this fixed for yesterday!
Tuesday, November 13, 12
Tuesday, November 13, 12
The Developer in the
                          other team


Tuesday, November 13, 12
I need to call your PHP
                  stuff but from Python


Tuesday, November 13, 12
I need to call your PHP
                  stuff but from Python

                           And also Java starting next week
Tuesday, November 13, 12
Tuesday, November 13, 12
The User



Tuesday, November 13, 12
I don’t want to wait
                           till your app resizes
                                 my image!


Tuesday, November 13, 12
You



Tuesday, November 13, 12
Tuesday, November 13, 12
Let’s see the
                           code evolution



                                            30
Tuesday, November 13, 12
Pseudo Code

                               Comments


           %% image_controller
           handle('PUT', "/user/image", ReqData) ->
             image_handler:do_upload(ReqData:get_file()),
             ok.




Tuesday, November 13, 12
Pseudo Code

                             Function Name


           %% image_controller
           handle('PUT', "/user/image", ReqData) ->
             image_handler:do_upload(ReqData:get_file()),
             ok.




Tuesday, November 13, 12
Pseudo Code

                               Arguments


           %% image_controller
           handle('PUT', "/user/image", ReqData) ->
             image_handler:do_upload(ReqData:get_file()),
             ok.




Tuesday, November 13, 12
Pseudo Code

                             Function Body


           %% image_controller
           handle('PUT', "/user/image", ReqData) ->
             image_handler:do_upload(ReqData:get_file()),
             ok.




Tuesday, November 13, 12
Pseudo Code

                              Return Value


           %% image_controller
           handle('PUT', "/user/image", ReqData) ->
             image_handler:do_upload(ReqData:get_file()),
             ok.




Tuesday, November 13, 12
First Implementation:

           %% image_controller
           handle('PUT', "/user/image", ReqData) ->
             image_handler:do_upload(ReqData:get_file()),
             ok.




Tuesday, November 13, 12
Second Implementation:

           %% image_controller
           handle('PUT', "/user/image", ReqData) ->
             {ok, Image} = image_handler:do_upload(ReqData:get_file()),
             resize_image(Image),
             ok.




Tuesday, November 13, 12
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.




Tuesday, November 13, 12
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.




Tuesday, November 13, 12
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.




Tuesday, November 13, 12
Can our code scale to
                   new requirements?



                                          41
Tuesday, November 13, 12
What if




                           42
Tuesday, November 13, 12
What if



                • We need to speed up image conversion




                                                         43
Tuesday, November 13, 12
What if



                • We need to speed up image conversion
                • User notification has to be sent by email




                                                              44
Tuesday, November 13, 12
What if



                • We need to speed up image conversion
                • User notification has to be sent by email
                • Stop tweeting about new images




                                                              45
Tuesday, November 13, 12
What if



                •   We need to speed up image conversion
                •   User notification has to be sent by email
                •   Stop tweeting about new images
                •   Resize in different formats




                                                                46
Tuesday, November 13, 12
What if



                •   We need to speed up image conversion
                •   User notification has to be sent by email
                •   Stop tweeting about new images
                •   Resize in different formats
                •   Swap Language / Technology




                                                                47
Tuesday, November 13, 12
What if



                •   We need to speed up image conversion
                •   User notification has to be sent by email
                •   Stop tweeting about new images
                •   Resize in different formats
                •   Swap Language / Technology (No Down Time)




                                                                48
Tuesday, November 13, 12
Can we do better?



                                               49
Tuesday, November 13, 12
Sure.
                           Using messaging



                                             50
Tuesday, November 13, 12
Design
                           Publish / Subscribe Pattern




Tuesday, November 13, 12
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).




Tuesday, November 13, 12
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).




Tuesday, November 13, 12
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').




Tuesday, November 13, 12
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).


Tuesday, November 13, 12
Second Implementation:




Tuesday, November 13, 12
Second Implementation:




                           THIS PAGE INTENTIONALLY LEFT BLANK




Tuesday, November 13, 12
Tuesday, November 13, 12
Messaging




                           59
Tuesday, November 13, 12
Messaging



                • Share data across processes




                                                60
Tuesday, November 13, 12
Messaging



                • Share data across processes
                • Processes can be part of different apps




                                                            61
Tuesday, November 13, 12
Messaging



                • Share data across processes
                • Processes can be part of different apps
                • Apps can live in different machines




                                                            62
Tuesday, November 13, 12
Messaging



                •   Share data across processes
                •   Processes can be part of different apps
                •   Apps can live in different machines
                •   Communication is Asynchronous




                                                              63
Tuesday, November 13, 12
Main Concepts




                           64
Tuesday, November 13, 12
Main Concepts



                • Messages are sent by Producers




                                                   65
Tuesday, November 13, 12
Main Concepts



                • Messages are sent by Producers
                • Messages are delivered to Consumers




                                                        66
Tuesday, November 13, 12
How can we
                 start using messaging
                         today?


                                         67
Tuesday, November 13, 12
Enter




                                   68
Tuesday, November 13, 12
Why Cloud Foundry is
                        Good™
                    for Messaging?


                                         69
Tuesday, November 13, 12
Key aspects of Cloud Foundry




                                    70
Tuesday, November 13, 12
Key aspects of Cloud Foundry

     • Supports many apps per account




                                        71
Tuesday, November 13, 12
Key aspects of Cloud Foundry

     • Supports many apps per account
     • Supports many services per account




                                            72
Tuesday, November 13, 12
Key aspects of Cloud Foundry

     • Supports many apps per account
     • Supports many services per account
     • Services can be shared across apps




                                            73
Tuesday, November 13, 12
Key aspects of Cloud Foundry

     •   Supports many apps per account
     •   Supports many services per account
     •   Services can be shared across apps
     •   Supports RabbitMQ by default




                                              74
Tuesday, November 13, 12
Intermission:




                            What is
                           RabbitMQ

                                      75
Tuesday, November 13, 12
RabbitMQ




                           76
Tuesday, November 13, 12
RabbitMQ

     • Multi Protocol Messaging Server




                                         77
Tuesday, November 13, 12
RabbitMQ

     • Multi Protocol Messaging Server
     • Open Source (MPL)




                                         78
Tuesday, November 13, 12
RabbitMQ

     • Multi Protocol Messaging Server
     • Open Source (MPL)
     • Part of Spring Source




                                         79
Tuesday, November 13, 12
RabbitMQ

     •   Multi Protocol Messaging Server
     •   Open Source (MPL)
     •   Part of Spring Source
     •   Supports AMQP, STOMP, MQTT




                                           80
Tuesday, November 13, 12
RabbitMQ

     •   Multi Protocol Messaging Server
     •   Open Source (MPL)
     •   Part of Spring Source
     •   Supports AMQP, STOMP, MQTT
     •   Has Clients for Many Platforms: Java, Ruby, node.js, PHP,
         Erlang, .Net., more




                                                                     81
Tuesday, November 13, 12
TELL ME MORE



                                          82
Tuesday, November 13, 12
TELL ME MORE
                             RabbitMQ Simulator Demo




                                                       83
Tuesday, November 13, 12
Sample App: CloudStagram




                                84
Tuesday, November 13, 12
Sample App: CloudStagram




                                85
Tuesday, November 13, 12
Sample App: CloudStagram




                                86
Tuesday, November 13, 12
Sample App: CloudStagram




                                87
Tuesday, November 13, 12
Sample App: CloudStagram




                                88
Tuesday, November 13, 12
Sample App: CloudStagram




                                89
Tuesday, November 13, 12
Sample App: CloudStagram




                                90
Tuesday, November 13, 12
Sample App: CloudStagram


    Frontend App
          node.js




                                91
Tuesday, November 13, 12
Sample App: CloudStagram


    Frontend App
          node.js




            Image Resizers
                   node.js


                                92
Tuesday, November 13, 12
Sample App: CloudStagram


    Frontend App
          node.js




            Image Resizers
                   Clojure


                                93
Tuesday, November 13, 12
CODE OR
        IT DIDN’T HAPPEN

                           94
Tuesday, November 13, 12
CODA

                                  95
Tuesday, November 13, 12
Messaging

                                96
Tuesday, November 13, 12
Scale



                    Messaging

                                97
Tuesday, November 13, 12
Scale      Decoupling



                    Messaging

                                        98
Tuesday, November 13, 12
Scale             Decoupling



                    Messaging
                           Polyglot
                                               99
Tuesday, November 13, 12
100
Tuesday, November 13, 12
Heavy
                  Lifting




                            101
Tuesday, November 13, 12
Heavy     Multi
                  Lifting   Apps




                                    102
Tuesday, November 13, 12
Heavy     Multi
                  Lifting   Apps




             Multi
            Services
                                    103
Tuesday, November 13, 12
Heavy       Multi
                  Lifting     Apps




             Multi            Cloud
            Services        Messaging
                                        104
Tuesday, November 13, 12
Sign Up Today



                     https://my.cloudfoundry.com/signup



                                                          105
Tuesday, November 13, 12
Questions?



                                        106
Tuesday, November 13, 12
Thanks!
                                    Álvaro Videla
                              http://twitter.com/old_sound
                              http://github.com/videlalvaro
                           http://www.slideshare.net/old_sound




                                                                 107
Tuesday, November 13, 12

More Related Content

PDF
A Picture Costs A Thousand Words
PDF
Desacoplando aplicaciones
PDF
Scaling webappswithrabbitmq
PDF
Integrating php withrabbitmq_zendcon
PDF
Integrating RabbitMQ with PHP
PDF
PHP, RabbitMQ, and You
PDF
Presentatie Document lifecycle2012
PDF
Continuous Delivery at Netflix
A Picture Costs A Thousand Words
Desacoplando aplicaciones
Scaling webappswithrabbitmq
Integrating php withrabbitmq_zendcon
Integrating RabbitMQ with PHP
PHP, RabbitMQ, and You
Presentatie Document lifecycle2012
Continuous Delivery at Netflix

Similar to Cloud Messaging With Cloud Foundry (20)

PDF
Adapt and respond: keeping responsive into the future
PDF
component: ruby gems for the browser
PDF
Multiplatform, Promises and HTML5
PDF
Html5 Audio & video
PDF
RTV Rijnmond slides voor discussie
PDF
Sortak
PDF
Building a Single-Page App: Backbone, Node.js, and Beyond
PDF
Html5 new sword for interactive app
PDF
Cassandra - PHP
PDF
Baking Delicious Modularity in Scala
PDF
RabbitMQ Hands On
PDF
Educause - Building a Responsive Website for the Presidential Debate
PDF
Working With Social APIs - SoMeT12
PDF
Responsive Web Design & Workflow
PDF
LiveRebel + Pragmatic Continuous Delivery (Arcusys)
PDF
Voices of the 4.5 Million: A Sound Visualization of the US Housing Crisis
PDF
Design process
PDF
Replacing Wordpress with Cascade Server (where possible) by Mike Roy
PDF
I Love Techno - the site
Adapt and respond: keeping responsive into the future
component: ruby gems for the browser
Multiplatform, Promises and HTML5
Html5 Audio & video
RTV Rijnmond slides voor discussie
Sortak
Building a Single-Page App: Backbone, Node.js, and Beyond
Html5 new sword for interactive app
Cassandra - PHP
Baking Delicious Modularity in Scala
RabbitMQ Hands On
Educause - Building a Responsive Website for the Presidential Debate
Working With Social APIs - SoMeT12
Responsive Web Design & Workflow
LiveRebel + Pragmatic Continuous Delivery (Arcusys)
Voices of the 4.5 Million: A Sound Visualization of the US Housing Crisis
Design process
Replacing Wordpress with Cascade Server (where possible) by Mike Roy
I Love Techno - the site
Ad

More from Alvaro Videla (20)

PDF
Improvements in RabbitMQ
PDF
Data Migration at Scale with RabbitMQ and Spring Integration
PDF
RabbitMQ Data Ingestion at Craft Conf
PDF
Scaling applications with RabbitMQ at SunshinePHP
PDF
Unit Test + Functional Programming = Love
PDF
RabbitMQ Data Ingestion
PDF
Dissecting the rabbit: RabbitMQ Internal Architecture
PDF
Introduction to RabbitMQ | Meetup at Pivotal Labs
PDF
Writing testable code
PDF
Rabbitmq Boot System
PDF
Cloud Foundry Bootcamp
PDF
Taming the rabbit
PDF
PDF
Código Fácil De Testear
PDF
Messaging patterns
PDF
Theres a rabbit on my symfony
PDF
Scaling Web Apps With RabbitMQ - Erlang Factory Lite
PDF
Integrating Erlang with PHP
PDF
Interoperability With RabbitMq
PDF
Debugging and Profiling Symfony Apps
Improvements in RabbitMQ
Data Migration at Scale with RabbitMQ and Spring Integration
RabbitMQ Data Ingestion at Craft Conf
Scaling applications with RabbitMQ at SunshinePHP
Unit Test + Functional Programming = Love
RabbitMQ Data Ingestion
Dissecting the rabbit: RabbitMQ Internal Architecture
Introduction to RabbitMQ | Meetup at Pivotal Labs
Writing testable code
Rabbitmq Boot System
Cloud Foundry Bootcamp
Taming the rabbit
Código Fácil De Testear
Messaging patterns
Theres a rabbit on my symfony
Scaling Web Apps With RabbitMQ - Erlang Factory Lite
Integrating Erlang with PHP
Interoperability With RabbitMq
Debugging and Profiling Symfony Apps
Ad

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Cloud computing and distributed systems.
PDF
Machine learning based COVID-19 study performance prediction
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Unlocking AI with Model Context Protocol (MCP)
Digital-Transformation-Roadmap-for-Companies.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Spectral efficient network and resource selection model in 5G networks
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Review of recent advances in non-invasive hemoglobin estimation
MIND Revenue Release Quarter 2 2025 Press Release
sap open course for s4hana steps from ECC to s4
Understanding_Digital_Forensics_Presentation.pptx
Cloud computing and distributed systems.
Machine learning based COVID-19 study performance prediction
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
MYSQL Presentation for SQL database connectivity
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Diabetes mellitus diagnosis method based random forest with bat algorithm
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
The AUB Centre for AI in Media Proposal.docx
Unlocking AI with Model Context Protocol (MCP)

Cloud Messaging With Cloud Foundry

  • 1. Cloud Messaging with Cloud Foundry Álvaro Videla - VMware © 2012 VMware, Inc. All rights reserved. Tuesday, November 13, 12
  • 2. About Me • Developer Advocate for Cloud Foundry • Blog: http://videlalvaro.github.com/ • Twitter: @old_sound 2 Tuesday, November 13, 12
  • 3. About Me • Developer Advocate for Cloud Foundry • Blog: http://videlalvaro.github.com/ • Twitter: @old_sound • I created gifsockets™ 3 Tuesday, November 13, 12
  • 4. About Me Co-authored RabbitMQ in Action http://bit.ly/rabbitmq 4 Tuesday, November 13, 12
  • 5. Classic Apps 5 Tuesday, November 13, 12
  • 6. Implement a Photo Gallery Tuesday, November 13, 12
  • 9. ‘Till new requirements arrive Tuesday, November 13, 12
  • 10. The Product Owner Tuesday, November 13, 12
  • 11. Can we also notify the user friends when she uploads a new image? Tuesday, November 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… Tuesday, November 13, 12
  • 14. The Social Media Guru Tuesday, November 13, 12
  • 15. We need to give badges to users for each picture upload Tuesday, November 13, 12
  • 16. We need to give badges to users for each picture upload and post uploads to Twitter Tuesday, November 13, 12
  • 19. Dumb! You’re delivering full size images! The bandwidth bill has tripled! Tuesday, November 13, 12
  • 20. Dumb! You’re delivering full size images! The bandwidth bill has tripled! We need this fixed for yesterday! Tuesday, November 13, 12
  • 22. The Developer in the other team Tuesday, November 13, 12
  • 23. I need to call your PHP stuff but from Python Tuesday, November 13, 12
  • 24. I need to call your PHP stuff but from Python And also Java starting next week Tuesday, November 13, 12
  • 27. I don’t want to wait till your app resizes my image! Tuesday, November 13, 12
  • 30. Let’s see the code evolution 30 Tuesday, November 13, 12
  • 31. Pseudo Code Comments %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Tuesday, November 13, 12
  • 32. Pseudo Code Function Name %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Tuesday, November 13, 12
  • 33. Pseudo Code Arguments %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Tuesday, November 13, 12
  • 34. Pseudo Code Function Body %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Tuesday, November 13, 12
  • 35. Pseudo Code Return Value %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Tuesday, November 13, 12
  • 36. First Implementation: %% image_controller handle('PUT', "/user/image", ReqData) -> image_handler:do_upload(ReqData:get_file()), ok. Tuesday, November 13, 12
  • 37. Second Implementation: %% image_controller handle('PUT', "/user/image", ReqData) -> {ok, Image} = image_handler:do_upload(ReqData:get_file()), resize_image(Image), ok. Tuesday, November 13, 12
  • 38. 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. Tuesday, November 13, 12
  • 39. 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. Tuesday, November 13, 12
  • 40. 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. Tuesday, November 13, 12
  • 41. Can our code scale to new requirements? 41 Tuesday, November 13, 12
  • 42. What if 42 Tuesday, November 13, 12
  • 43. What if • We need to speed up image conversion 43 Tuesday, November 13, 12
  • 44. What if • We need to speed up image conversion • User notification has to be sent by email 44 Tuesday, November 13, 12
  • 45. What if • We need to speed up image conversion • User notification has to be sent by email • Stop tweeting about new images 45 Tuesday, November 13, 12
  • 46. What if • We need to speed up image conversion • User notification has to be sent by email • Stop tweeting about new images • Resize in different formats 46 Tuesday, November 13, 12
  • 47. What if • We need to speed up image conversion • User notification has to be sent by email • Stop tweeting about new images • Resize in different formats • Swap Language / Technology 47 Tuesday, November 13, 12
  • 48. What if • We need to speed up image conversion • User notification has to be sent by email • Stop tweeting about new images • Resize in different formats • Swap Language / Technology (No Down Time) 48 Tuesday, November 13, 12
  • 49. Can we do better? 49 Tuesday, November 13, 12
  • 50. Sure. Using messaging 50 Tuesday, November 13, 12
  • 51. Design Publish / Subscribe Pattern Tuesday, November 13, 12
  • 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). Tuesday, November 13, 12
  • 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). Tuesday, November 13, 12
  • 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'). Tuesday, November 13, 12
  • 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). Tuesday, November 13, 12
  • 57. Second Implementation: THIS PAGE INTENTIONALLY LEFT BLANK Tuesday, November 13, 12
  • 59. Messaging 59 Tuesday, November 13, 12
  • 60. Messaging • Share data across processes 60 Tuesday, November 13, 12
  • 61. Messaging • Share data across processes • Processes can be part of different apps 61 Tuesday, November 13, 12
  • 62. Messaging • Share data across processes • Processes can be part of different apps • Apps can live in different machines 62 Tuesday, November 13, 12
  • 63. Messaging • Share data across processes • Processes can be part of different apps • Apps can live in different machines • Communication is Asynchronous 63 Tuesday, November 13, 12
  • 64. Main Concepts 64 Tuesday, November 13, 12
  • 65. Main Concepts • Messages are sent by Producers 65 Tuesday, November 13, 12
  • 66. Main Concepts • Messages are sent by Producers • Messages are delivered to Consumers 66 Tuesday, November 13, 12
  • 67. How can we start using messaging today? 67 Tuesday, November 13, 12
  • 68. Enter 68 Tuesday, November 13, 12
  • 69. Why Cloud Foundry is Good™ for Messaging? 69 Tuesday, November 13, 12
  • 70. Key aspects of Cloud Foundry 70 Tuesday, November 13, 12
  • 71. Key aspects of Cloud Foundry • Supports many apps per account 71 Tuesday, November 13, 12
  • 72. Key aspects of Cloud Foundry • Supports many apps per account • Supports many services per account 72 Tuesday, November 13, 12
  • 73. Key aspects of Cloud Foundry • Supports many apps per account • Supports many services per account • Services can be shared across apps 73 Tuesday, November 13, 12
  • 74. Key aspects of Cloud Foundry • Supports many apps per account • Supports many services per account • Services can be shared across apps • Supports RabbitMQ by default 74 Tuesday, November 13, 12
  • 75. Intermission: What is RabbitMQ 75 Tuesday, November 13, 12
  • 76. RabbitMQ 76 Tuesday, November 13, 12
  • 77. RabbitMQ • Multi Protocol Messaging Server 77 Tuesday, November 13, 12
  • 78. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) 78 Tuesday, November 13, 12
  • 79. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) • Part of Spring Source 79 Tuesday, November 13, 12
  • 80. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) • Part of Spring Source • Supports AMQP, STOMP, MQTT 80 Tuesday, November 13, 12
  • 81. RabbitMQ • Multi Protocol Messaging Server • Open Source (MPL) • Part of Spring Source • Supports AMQP, STOMP, MQTT • Has Clients for Many Platforms: Java, Ruby, node.js, PHP, Erlang, .Net., more 81 Tuesday, November 13, 12
  • 82. TELL ME MORE 82 Tuesday, November 13, 12
  • 83. TELL ME MORE RabbitMQ Simulator Demo 83 Tuesday, November 13, 12
  • 84. Sample App: CloudStagram 84 Tuesday, November 13, 12
  • 85. Sample App: CloudStagram 85 Tuesday, November 13, 12
  • 86. Sample App: CloudStagram 86 Tuesday, November 13, 12
  • 87. Sample App: CloudStagram 87 Tuesday, November 13, 12
  • 88. Sample App: CloudStagram 88 Tuesday, November 13, 12
  • 89. Sample App: CloudStagram 89 Tuesday, November 13, 12
  • 90. Sample App: CloudStagram 90 Tuesday, November 13, 12
  • 91. Sample App: CloudStagram Frontend App node.js 91 Tuesday, November 13, 12
  • 92. Sample App: CloudStagram Frontend App node.js Image Resizers node.js 92 Tuesday, November 13, 12
  • 93. Sample App: CloudStagram Frontend App node.js Image Resizers Clojure 93 Tuesday, November 13, 12
  • 94. CODE OR IT DIDN’T HAPPEN 94 Tuesday, November 13, 12
  • 95. CODA 95 Tuesday, November 13, 12
  • 96. Messaging 96 Tuesday, November 13, 12
  • 97. Scale Messaging 97 Tuesday, November 13, 12
  • 98. Scale Decoupling Messaging 98 Tuesday, November 13, 12
  • 99. Scale Decoupling Messaging Polyglot 99 Tuesday, November 13, 12
  • 101. Heavy Lifting 101 Tuesday, November 13, 12
  • 102. Heavy Multi Lifting Apps 102 Tuesday, November 13, 12
  • 103. Heavy Multi Lifting Apps Multi Services 103 Tuesday, November 13, 12
  • 104. Heavy Multi Lifting Apps Multi Cloud Services Messaging 104 Tuesday, November 13, 12
  • 105. Sign Up Today https://my.cloudfoundry.com/signup 105 Tuesday, November 13, 12
  • 106. Questions? 106 Tuesday, November 13, 12
  • 107. Thanks! Álvaro Videla http://twitter.com/old_sound http://github.com/videlalvaro http://www.slideshare.net/old_sound 107 Tuesday, November 13, 12