[rabbitmq-discuss] HTTP Plugin?

Simon MacMullen simon at rabbitmq.com
Tue Oct 11 12:11:26 BST 2011


On 10/10/11 22:13, Marv Lush wrote:
> Hello all. I'm looking for the easiest way to push JSON messages to my
> broker from a shell script, without installing erlang on my producers.
> The most * convenient* way I can think of doing this is curl and HTTP.
>
> I looked at MochiWeb...but unless the documentation is incomplete...it
> doesn't seem to support something like:
>
> POST http://mybroker:1234/myRoutingKey
> {
> "key1":"value1",
> "key2":"value2"
> }

Well, Mochiweb is a general purpose web server, it doesn't do anything 
rabbit-y by itself.

> I also looked at JSONRPC, but that doesn't seem to do the trick either.
> Is there another plugin that would allow this? Preferably(but not
> required), one that would also allow me to consume from a queue by doing
> something like:
>
> GET http://mybroker:1234/queueName/consume
>
>
> Or something, like that...you get the idea...

The closest thing to what you're looking for is currently in the 
management plugin - see /api/exchanges/[vhost]/[name]/publish and 
/api/queues/[vhost]/[name]/get, documented at:

http://hg.rabbitmq.com/rabbitmq-management/raw-file/rabbitmq_v2_6_1/priv/www/api/index.html

If you want to publish from a shell script, the rabbitmqadmin tool that 
ships with mgmt should be more convenient than curl for talking to this API.

http://www.rabbitmq.com/management-cli.html

But bear in mind that this API doesn't make any attempt to deal with 
acking in either direction - if your HTTP connection is interrupted you 
could lose messages. I don't know if this is a big deal for you. If it 
is, I would write some little script with one of the Python or Ruby APIs 
to do the right thing over AMQP.

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, VMware


More information about the rabbitmq-discuss mailing list