[rabbitmq-discuss] async client

Michael Klishin michael.s.klishin at gmail.com
Thu Apr 28 14:07:59 BST 2011


2011/4/25 Ben Browitt <ben.browitt at gmail.com>

> I have a service on one server that need to get messages from several
> websites on remote servers.
> A message will be triggered by a user action in a website. For example,
> when a user login or post a comment.
> Messages are small, frequency will be low and it is not critical if
> messages are lost.
>

First question: if message volume is low, maybe a synchronous client will do
just fine? They are somewhat easier to
use.


> The easiest thing to do is send an http request from the website to the
> service but that will block the user request.
> Another option is to store messages in a database on the website server and
> poll it with a cron job or a request from the service but it's dirty.
>
>
Several databases provide publish/subscribe implementation of some kind, for
example, PostgreSQL and Redis.


> I would like to use rabbitmq for this.
> The service will have a rabbitmq server with a client for each website.
> Each website will have a rabbitmq client that will publish messages to the
> server.
>

This is a pretty common use case for RabbitMQ, as far as I can tell.


> Websites will use php, python or ruby.
> Do I need to use a different client for each language?
>

Yes. I am not aware of any way to use, say, a Python library from Ruby or
vice versa, and
if doing so is worth the effort anyway.

I am not the right person to recommend Python and PHP libraries,
but if you want an asynchronous Ruby client, amqp gem [1] is a very widely
used option. More importantly, it is actively maintained.
I recommend you to use version in git repository (worry not that it is
pre-release; we are very
close to final release and majority of work is now on paying off
documentation debt [2]) because all examples are
now written for it. All maintainers are on this list.


>
> Is the client async, meaning that the php code will ask it to send the
> message but won't need to wait for it?
>
>
that function that sends your message won't wait for message to be sent.
Instead, it will return immediately.


My impression is that publishing messages directly to RabbitMQ without any
extra layers in the middle would
work fine for your case. Sure, using 3 client libraries is a bit annoying
but I am not aware of any messaging solution that
lets you reuse Python libraries from PHP or something like that. JVM
languages all can use Java client, though.


Hope this helps.

1. https://github.com/ruby-amqp/amqp
2. http://rdoc.info/github/ruby-amqp/amqp/master/frames
-- 
MK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110428/34ed91eb/attachment-0001.htm>


More information about the rabbitmq-discuss mailing list