Integrating RabbitMQ with PHP

37,210 views

Published on

Talk for the conference at IPC Spring Edition 2010 - Berlin

3 Comments
53 Likes
Statistics
Notes
  • Try asking your question here: https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

    Also 500k a day is nothing. WIth RabbitMQ you can easily do 10k/second
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • you said 500, 000 + messages routed in a day. What kind of app have you created. I myself am trying to create a message generator in php. and using that message I am planning on creating an app using RabbitMQ to send messages to users. I am at square 1. what should I do? what should be my design.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • The video on how to install/run RabbitMQ is here: http://www.vimeo.com/10254034
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
37,210
On SlideShare
0
From Embeds
0
Number of Embeds
183
Actions
Shares
0
Downloads
398
Comments
3
Likes
53
Embeds 0
No embeds

No notes for slide

Integrating RabbitMQ with PHP

  1. 1. Integrating RabbitMQ with PHP Álvaro Videla June 2010 - IPC Spring Edition - Berlin Wednesday, June 2, 2010
  2. 2. About Me • Lead Developer at TheNetCircle.com • Writing “RabbitMQ in Action” for Manning • Twitter: @old_sound • Blog: http://obvioushints.blogspot.com/ Wednesday, June 2, 2010
  3. 3. The Interoperability Problem Wednesday, June 2, 2010
  4. 4. The Problem Movie Publisher Wednesday, June 2, 2010
  5. 5. The Problem Movie New Movie Publisher Wednesday, June 2, 2010
  6. 6. The Problem Java WebService XML Movie New Movie Publisher Wednesday, June 2, 2010
  7. 7. The Problem Java WebService XML C++ Image Thumbnail Generator Movie New Movie Publisher Wednesday, June 2, 2010
  8. 8. The Problem Java WebService XML C++ Image Thumbnail Generator Movie New Movie Publisher PHP PHP Cache Generator Wednesday, June 2, 2010
  9. 9. The Problem Java WebService XML C++ Image Thumbnail Generator Movie New Movie Publisher PHP PHP Cache Generator PHP Static HTML Publisher Wednesday, June 2, 2010
  10. 10. The Problem Java WebService XML C++ Image Thumbnail Generator Movie New Movie Publisher PHP PHP Cache Generator PHP Static HTML Publisher C++ Trailers Generator Wednesday, June 2, 2010
  11. 11. The Problem SYSTEMS WebService XML Image Thumbnail Generator PHP Cache Generator Static HTML Publisher Trailers Generator Wednesday, June 2, 2010
  12. 12. The Problem SYSTEMS WebService XML Written In Different Languages Image Thumbnail Generator PHP Cache Generator Static HTML Publisher Trailers Generator Wednesday, June 2, 2010
  13. 13. The Problem SYSTEMS WebService XML Written In Different Languages Image Different Operating Systems Thumbnail Generator PHP Cache Generator Static HTML Publisher Trailers Generator Wednesday, June 2, 2010
  14. 14. The Problem SYSTEMS WebService XML Written In Different Languages Image Different Operating Systems Thumbnail Generator Written By Different People PHP Cache Generator Static HTML Publisher Trailers Generator Wednesday, June 2, 2010
  15. 15. The Problem SYSTEMS WebService XML Written In Different Languages Image Different Operating Systems Thumbnail Generator Written By Different People PHP Cache Generator They Need To Share Information Static HTML Publisher Trailers Generator Wednesday, June 2, 2010
  16. 16. The Problem SYSTEMS WebService XML Written In Different Languages Image Different Operating Systems Thumbnail Generator Written By Different People PHP Cache Generator They Need To Share Information Static They Need Real Time Data HTML Publisher Trailers Generator Wednesday, June 2, 2010
  17. 17. The Problem SYSTEMS WebService XML Written In Different Languages Image Different Operating Systems Thumbnail Generator Written By Different People PHP Cache Generator They Need To Share Information Static They Need Real Time Data HTML Publisher They Need To Scale Trailers Generator Wednesday, June 2, 2010
  18. 18. Is There a Solution? Wednesday, June 2, 2010
  19. 19. AMQP and RabbitMQ Wednesday, June 2, 2010
  20. 20. AMQP • Advanced Message Queuing Protocol • Suits Interoperability • Completely Open Protocol • Binary Protocol • AMQP Model • AMQP Wire Format Wednesday, June 2, 2010
  21. 21. AMQP Model • Exchanges • Message Queues • Bindings • Rules for binding them Wednesday, June 2, 2010
  22. 22. AMQP Wire Protocol • Functional Layer • Transport Layer Wednesday, June 2, 2010
  23. 23. Message Flow http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messaging_Tutorial/chap-Messaging_Tutorial-Initial_Concepts.html Wednesday, June 2, 2010
  24. 24. Exchange Types • Fanout • Direct • Topic Wednesday, June 2, 2010
  25. 25. Default Exchanges • amqp.fanout • amqp.direct • amqp.topic Wednesday, June 2, 2010
  26. 26. http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messaging_Tutorial/sect-Messaging_Tutorial-Initial_Concepts- Fanout_Exchange.html Wednesday, June 2, 2010
  27. 27. http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messaging_Tutorial/sect-Messaging_Tutorial-Initial_Concepts- Direct_Exchange.html Wednesday, June 2, 2010
  28. 28. http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messaging_Tutorial/sect-Messaging_Tutorial-Initial_Concepts- Topic_Exchange.html Wednesday, June 2, 2010
  29. 29. Sample usage Wednesday, June 2, 2010
  30. 30. Sample Usage II Wednesday, June 2, 2010
  31. 31. Other Advantages • Fire and Forget • Stop/Start consumers safely (no need for last processed id) • No need for Cronjobs locks • Load Distribution • Transactions Wednesday, June 2, 2010
  32. 32. RabbitMQ Wednesday, June 2, 2010
  33. 33. RabbitMQ • Enterprise Messaging System • Open Source MPL • Written in Erlang/OTP • Commercial Support Wednesday, June 2, 2010
  34. 34. Features • Reliable and High Scalable • Easy To install • Easy To Cluster • Runs on: Windows, Solaris, Linux, OSX • AMQP 0.8 Wednesday, June 2, 2010
  35. 35. Client Libraries • Java • .NET/C# • Erlang • Ruby, Python, PHP, Perl, AS3, Lisp, Scala Wednesday, June 2, 2010
  36. 36. Docs/Support • http://www.rabbitmq.com/documentation.html • http://dev.rabbitmq.com/wiki/ • #rabbitmq at irc.freenode.net • http://www.rabbitmq.com/email-archive.html Wednesday, June 2, 2010
  37. 37. Our Setup: Publishers - 28 PHP Frontend Machines 2 PHP Machines running 24 consumers each Wednesday, June 2, 2010
  38. 38. Our Setup • Deployed in mid 2009 • Reduced site SPOF • 500.000+ messages routed a day (and increasing) • Very easy to install/deploy Wednesday, June 2, 2010
  39. 39. Easy To Install? Wednesday, June 2, 2010
  40. 40. Easy To Install? http://gist.github.com/334219 Wednesday, June 2, 2010
  41. 41. PHP Integration • http://code.google.com/p/php-amqplib/ • http://code.google.com/p/php-amqp/ • http://code.google.com/p/php-rabbit/ Wednesday, June 2, 2010
  42. 42. Show me the code! Wednesday, June 2, 2010
  43. 43. RabbitMQ “Hello World!” Wednesday, June 2, 2010
  44. 44. AMQP Producer Wednesday, June 2, 2010
  45. 45. AMQP Producer Wednesday, June 2, 2010
  46. 46. AMQP Producer Wednesday, June 2, 2010
  47. 47. AMQP Producer Wednesday, June 2, 2010
  48. 48. AMQP Producer Wednesday, June 2, 2010
  49. 49. AMQP Consumer Wednesday, June 2, 2010
  50. 50. AMQP Consumer Wednesday, June 2, 2010
  51. 51. AMQP Consumer Wednesday, June 2, 2010
  52. 52. AMQP Consumer Wednesday, June 2, 2010
  53. 53. AMQP Consumer Wednesday, June 2, 2010
  54. 54. AMQP Consumer Wednesday, June 2, 2010
  55. 55. AMQP Consumer Wednesday, June 2, 2010
  56. 56. RabbitMQ RPC Example Wednesday, June 2, 2010
  57. 57. RPC Client Wednesday, June 2, 2010
  58. 58. RPC Client Wednesday, June 2, 2010
  59. 59. RPC Client Wednesday, June 2, 2010
  60. 60. RPC Client Wednesday, June 2, 2010
  61. 61. RPC Client Wednesday, June 2, 2010
  62. 62. RPC Server Wednesday, June 2, 2010
  63. 63. RPC Server Wednesday, June 2, 2010
  64. 64. RPC Server Wednesday, June 2, 2010
  65. 65. RPC Server Wednesday, June 2, 2010
  66. 66. RPC Server Wednesday, June 2, 2010
  67. 67. RPC Server Wednesday, June 2, 2010
  68. 68. RPC Server Wednesday, June 2, 2010
  69. 69. Resources: • http://www.rabbitmq.com/ • https://www.amqp.org/confluence/display/AMQP/About+AMQP • http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/ Messaging_Tutorial/index.html • http://wso2.org/library/articles/using-axis2-c-amqp-transport-part-i • http://www.skaag.net/2010/03/12/rabbitmq-for-beginners/ • http://github.com/bkw/php-amqp Wednesday, June 2, 2010
  70. 70. Questions? Wednesday, June 2, 2010
  71. 71. Thanks! Alvaro Videla http://twitter.com/old_sound http://www.slideshare.net/old_sound Wednesday, June 2, 2010

×