[rabbitmq-discuss] Another Use-case?
majek04 at gmail.com
Fri Feb 11 11:49:21 GMT 2011
On Wed, Feb 9, 2011 at 15:06, Olle Jonsson <olle.jonsson at gmail.com> wrote:
> Would Facebook's Real-time updates be a typical AMQP job?
> Sample PHP callback to that API
> My question: Would it be good and AMQP-like to have that callback.php file
> (aka "the end-point") enqueue messages instead of working on them?
> best regards from the sidelines,
I guess you could just do the work in 'callback.php'.
I'm not sure what guarantees does the facebook give you
but it seems probable to receive two updates relating to the
same object (user) at the same time.
If your app doesn't take that into account, you may end up
in having a race condition between those two requests.
To make sure you process only one update at a time
you could serialize them - RabbitMQ queue is
a perfect choice for that.
The other advantage of offloading work to rabbit, is that
on facebook update you may want to query facebook
API to receive updated details. That may take some time
and you don't want any blocking in code to run inside
a web server (like apache+php).
More information about the rabbitmq-discuss