News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Brandon Savage:
Consuming RabbitMQ messages with PHP
May 31, 2013 @ 09:15:47

Brandon Savage continues his look at using RabbitMQ and PHP together to queue up requests today in this latest post. In this new part of the series, he focuses on the last piece of the puzzle - consuming the requests in the queue. (Parts one and two)

Once you've created a RabbitMQ producer, it's fairly easy to create a consumer. In fact, the only difference is in exactly what commands you're using. The connection, envelope, channel and queue declarations are the same. While in RabbitMQ you publish to the exchange, you actually do consume a specific queue. As a result, the commands for consuming are part of the AMQPQueue class.

He shows you how to set up the code to sit in the background and wait for a queue request and how to fetch them in a non-blocking way. He finishes off the post with a look at handling success and error conditions (based on the status of message consumption, not the result of the processing).

0 comments voice your opinion now!
rabbitmq tutorial consume amqp library success failure nonblocking background

Link: http://www.brandonsavage.net/consuming-rabbitmq-messages-with-php

Brandon Savage:
Publishing messages to RabbitMQ with PHP
May 30, 2013 @ 10:09:49

Brandon Savage has posted the second article in his RabbitMQ+PHP series today with a look at publishing messages to the queue. (Part one is here)

Now that we understand the basics behind RabbitMQ, it's time for us to start working with it. The first step in working with RabbitMQ is to begin sending messages to the exchange so that they can be queued. In RabbitMQ parlance, the "producer" is responsible for "publishing" the messages to the exchange.

He includes the code you'll need to use the AMQP PHP extension to connect with the RabbitMQ server and select a channel. He also shows how to set up an "exchange" and "queue" and bind them to each other. Finally, there's the one line of code that uses the routing key value to push a message into the waiting service.

0 comments voice your opinion now!
rabbitmq publishing message tutorial queue exchange connection

Link: http://www.brandonsavage.net/publishing-messages-to-rabbitmq-with-php

Brandon Savage:
Queuing with RabbitMQ and PHP
May 28, 2013 @ 09:41:39

Brandon Savage has posted a quick overview of working with PHP and RabbitMQ for queuing. This is the first part of a three-part series about using these two technologies together effectively.

There are many times that you want to write background processes and queue up the tasks so that they can be handled in sequential order. There are any number of queues available for software developers, and one that I've really taken a liking to is RabbitMQ. Besides the fact that the queue is designed to requeue messages that are unsuccessfully delivered, RabbitMQ is fast and efficient.

He introduces some of the basic concepts behind working with RabbitMQ (like connections and channels) and an "exchange" - the method by which messages are routed. He talks about pushing messages to the exchange to be handled and how you consume the queue for updates. He also links to the various things you'll need to install to start combining these two tools including the AMPQ PECL extension.

0 comments voice your opinion now!
queue rabbitmq ampq pecl install overview series

Link: http://www.brandonsavage.net/queuing-with-rabbitmq-and-php

Alvaro Videla:
Using RabbitMQ in Unit Tests
May 01, 2013 @ 09:10:11

Alvaro Videla has a new post today showing how he used RabbitMQ in his unit testing runs with a small, quickly installed version of the server that can be removed once the tests are complete.

In this blog post I want to show you a very simple technique for using RabbitMQ in our Unit or Functional Tests. Let's say you wrote a bunch of tests for your RabbitMQ consumers and then it's time to run them. To do that you probably need to setup a RabbitMQ server just for tests with their own users and passwords, or you need to set up a whole new virtual host for your tests. [...] With a future release of RabbitMQ that we can already test on the nightlies website, we can run RabbitMQ without the need to install Erlang. We created a package that ships a stripped down version of Erlang together with the broker bits, so running RabbitMQ now is as easy as downloading a tarball, uncompressing it and starting the server.

With a combination of this more self-contained package and some listener handling through PHPUnit, they uncompress the tarball with a PHP script and start the server with the defined configuration. Then, once the tests are done, it cleans itself up and removes the entire server directory to make for a clean run the next time.

0 comments voice your opinion now!
rabbitmq standalone server erlang unittest phpunit

Link: http://videlalvaro.github.io/2013/04/using-rabbitmq-in-unit-tests.html

PHPMaster.com:
Message Brokering with RabbitMQ
August 21, 2012 @ 11:04:07

On PHPMaster.com today they've posted a new tutorial that helps you get started adding queuing to your application with PHP and RabbitMQ.

RabbitMQ is open-source message brokering software written in Erlang. The MQ in its name refers to a standard known as Advanced Message Queuing Protocol. For our purposes, and most others, it acts as a middleman between producer (sending) and consumer (receiving) programs - it simply accepts and forwards messages. [...] Both producers and consumers can be written in any language that has an available RabbitMQ or AMQP client library. In this article, I'll demo a producer program written in PHP and a consuming program in Python.

He walks you through the installation for both RabbitMQ itself and the PHP (php-amqlib) and Python (pika) tools to use for the interfaces. There's some details on how the queuing system works and the code for the sample clients is included as well as commands to use the two clients to send/receive messages.

0 comments voice your opinion now!
rabbitmq message queue tutorial python client


Artur Ejsmont's Blog:
Publishing queue messages from PHP using different backends
March 26, 2012 @ 11:31:53

Artur Ejsmont has a new post sharing some benchmarks he put together about the "messages per second" and "time to execute" when using PHP to pull from various messaging backends.

I have looked at the state of different messaging backends recently and i ran a little benchmark to see what is the rough comparison of message publishing throughput. Results that i got are quite surprising. What i wanted to achieve is some sort of reassurance before choosing a messaging bus for my PHP project.

Running both the PHP and the messaging test scripts on the same server, he pulled from a few different backend systems - RabbitMQ, MySQL, MongoDb, Memcached and ActiveMQ. The results were interesting, showing an interesting result in the time it took to execute versus the number of messages per second pushed in.

0 comments voice your opinion now!
benchmark message queue backend rabbitmq mysql mongodb memcached activemq


Mfana Ronald Conco's Blog:
RabbitMQ and PHP Part 2 - Durable Queues and Persistent Messages
March 22, 2012 @ 13:39:56

Mfana Ronald Conco has posted the second part of his RabbitMQ and PHP series to his blog today. This time he looks at durable queues and persistent messages

You now have a queuing system that works and generates pdfs which are sent to users as per RabbitMQ and PHP Part 1 of this article. A week later after launching the queuing system you get one or two queries from users who claim to have made a request to get the pdf report but it never arrived. Okay, what could have happened ? well you go through the application log files and as suspected - An Exception was thrown by one your classes as the consumer was trying to create the pdf and that is why it was never sent. Now this compromises the queuing system Totally, But wait there is a way to help prevent such.

He shows how to make your queues "durable", meaning they'll survive a broker restart and they require a response from the consumer before being removed. He shows how (via the php-ampq functionality) to add the "AMPQ_DURABLE" flag to the queue definition. He also includes some code showing how to send back the acknowledgement so the entry can be removed from the queue. He also includes an update to the code that calls "publish" to make the messages persistent too.

0 comments voice your opinion now!
rabbitmq tutorial extension phpampq durable queue persistent message


Mfana Ronald Conco's Blog:
RabbitMQ and PHP Part 1
March 19, 2012 @ 13:48:54

In this recent blog post Mfana Ronald Conco looks at combining the RabbitMQ messaging service with PHP, complete with all of the setup instructions (and configuration) you'll need.

There are times when you have to make certain features of your PHP application to work asynchronously, and there are times when you do not have to - I will explain this better by introducing every day scenarios.

His two scenarios have a common thread - the need for asynchronous processing, especially for something that can scale as the user base grows. With the help of RabbitMQ he shows you how to install the MW server, get the php-ampq extension for PHP installed and two sample scripts - one to send a message to the broker, the other to receive and parse the result of a job.

0 comments voice your opinion now!
rabbitmq tutorial extension phpampq setup configuration


Bradley Holt's Blog:
Exploring RabbitMQ and PHP
July 21, 2011 @ 09:13:17

In a new post Bradley Holt looks at some of his exploration into the combination of RabbitMQ and PHP as a possible platform for messaging between process (or applications).

I'm exploring the possibility of using RabbitMQ for an upcoming project. RabbitMQ is a free/open source message broker platform. It uses the open Advanced Message Queuing Protocol (AMQP) standard and is written in Erlang using the Open Telecom Platform (OTP). It promises a high level of availability, throughput, scalability, and portability. Since it is built using open standards, it is interoperable with other messaging systems and can be accessed from any platform.

He goes through the full process - installing RabbitMQ via MacPorts, grabbing the latest copy of the librabbitmq library and installing it and finally installing the AMQP extension for PHP so they can communicate. He includes some simple code that connects to the queue and sends a "hello world" message out to the connection bound to "routeA".

0 comments voice your opinion now!
rabbitmq messaging protocol platform tutorial extension librabbitmq pecl



Community Events





Don't see your event here?
Let us know!


list api developer testing language podcast wordpress introduction unittest series install threedevsandamaybe laravel framework code refactor community opinion release interview

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework