The document discusses integrating RabbitMQ with Symfony2 to enable asynchronous messaging capabilities. It describes how RabbitMQ and the AMQP protocol allow for decoupling of components through message passing. Examples are provided of using RabbitMQ for batch processing and image uploading tasks in Symfony2, including code for a publisher and consumer.
86. Requirements
• Several Web Servers
Thursday, March 3, 2011
87. Requirements
• Several Web Servers
• Logic Separated by Module/Action
Thursday, March 3, 2011
88. Requirements
• Several Web Servers
• Logic Separated by Module/Action
• Several Log Levels:
Thursday, March 3, 2011
89. Requirements
• Several Web Servers
• Logic Separated by Module/Action
• Several Log Levels:
• Info, Warning, Error
Thursday, March 3, 2011
90. Requirements
• Several Web Servers
• Logic Separated by Module/Action
• Several Log Levels:
• Info, Warning, Error
• Add/Remove log listeners at will
Thursday, March 3, 2011
120. RabbitMQ Bundle
Using a Producer:
public function indexAction($name)
{
...
$msg = array('user_id' => 1235,
'image_path' => '/path/to/new/pic.png');
$this->get('rabbitmq.upload_picture_producer')->
publish(serialize($msg));
...
}
Thursday, March 3, 2011
121. RabbitMQ Bundle
Consumer Class:
class UploadPictureConsumer extends ContainerAware
implements ConsumerInterface
{
public function execute($msg)
{
// Process picture upload.
// $msg will be what was published
// from the Controller.
}
}
Thursday, March 3, 2011
123. RabbitMQ Bundle
Recap:
• Add an entry for the consumer/producer in
the configuration.
Thursday, March 3, 2011
124. RabbitMQ Bundle
Recap:
• Add an entry for the consumer/producer in
the configuration.
• Implement your Callback.
Thursday, March 3, 2011
125. RabbitMQ Bundle
Recap:
• Add an entry for the consumer/producer in
the configuration.
• Implement your Callback.
• Start the consumer from the CLI.
Thursday, March 3, 2011
126. RabbitMQ Bundle
Recap:
• Add an entry for the consumer/producer in
the configuration.
• Implement your Callback.
• Start the consumer from the CLI.
• Add code to publish messages.
Thursday, March 3, 2011
133. RabbitMQ
• Enterprise Messaging System
• Open Source MPL
• Written in Erlang/OTP
• Commercial Support
Thursday, March 3, 2011
134. Features
• Reliable and High Scalable
• Easy To install
• Easy To Cluster
• Runs on: Windows, Solaris, Linux, OSX
• AMQP 0.8 - 0.9.1
Thursday, March 3, 2011