BUG? RabbitMQ Management HTTP API : publish to default exchange on vhost / fails to route payload

662 views
Skip to first unread message

Malcolm Cook

unread,
Sep 8, 2015, 3:52:46 PM9/8/15
to rabbitmq-discuss
Hi,

rabbitMQ works fine using rabbitmqadmin as evidenced:

$ rabbitmqadmin  declare queue  name=test_RK
queue declared
$ PAYLOAD="this is the payload"
$ rabbitmqadmin publish routing_key=test_RK payload="${PAYLOAD}"
Message published
$ rabbitmqadmin get queue=test_RK  payload_file=payload.json requeue=false
+-------------+----------+---------------+---------------+-------------+
| routing_key | exchange | message_count | payload_bytes | redelivered |
+-------------+----------+---------------+---------------+-------------+
| test_RK     |          | 0             | 19            | False       |
+-------------+----------+---------------+---------------+-------------+
$ cat payload.json
this is the payload

However, my attempts to use rabbitmq_management to publish messages so far fail....

Enabling the plugin succeeds:

sudo rabbitmq-plugins enable rabbitmq_management  
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to rabbit@beta... started 5 plugins.


...and POSTing seems successful, returning 204 (note: the queue name is blank, which should by my reading correspond to the default queue)


$ curl -i -u guest:guest \
>      -H "content-type:application/json" \
>      -XPUT -d$'{"routing_key":"test_RK","payload":"my body","properties":{},"payload_encoding":"string"}' \
HTTP/1.1 204 No Content
Server: MochiWeb/1.1 WebMachine/1.10.0 (never breaks eye contact)
Date: Tue, 08 Sep 2015 19:16:07 GMT
Content-Type: application/json
Content-Length: 0

...but alas the queue is empty:

$ rabbitmqadmin list queues vhost name node messages message_stats.publish_details.rate
+-------+---------+-------------+----------+------------------------------------+
| vhost |  name   |    node     | messages | message_stats.publish_details.rate |
+-------+---------+-------------+----------+------------------------------------+
| /     | hello   | rabbit@beta | 1        |                                    |
| /     | test_RK | rabbit@beta | 0        | 0.0                                |
+-------+---------+-------------+----------+------------------------------------+

When I use the web management console to manually publish to the default Exchange (AMQP default) in virtual host / using a routing_key of "test_RK", I get the warning "Message published but not routed" unless I choose persistent delivery mode, in which case the payload is appears on queue test_RK.  This does not really make sense to me as message routing and durability seem to be orthoganal concepts.  FWIW, returning to the URL API, I tried PUTTING ...,"properties":{"delivery_mode":"persistent"}... to no avail.

What am I doing wrong?  Or is rabbitmq not acting as should be expected?

On a related note, I am aware that it is unadvised to use RabbitMQ Management HTTP API  (i.e. https://groups.google.com/d/msg/rabbitmq-users/7X-tuOTSOaQ/fqPi54cel2sJ ) however my partner is reluctant to make his php/symphony application dependent upon additional libraries and requests I explose a "web-hook" interface to my application.  Thus I am lead to trying this HTTP API.  If there are better options that this, I am happy to learn.  Rabbithub looked interested, except in http://eighty-twenty.org/2012/05/15/rabbithub-status.html  I read from May 2012 that Rabbithub hasn’t been maintained for a while now. It lags the current state-of-the-art in two respects...  

Any advice on all this is much appreciated.

The above is using: rabbitmqadmin 3.5.4

~Malcolm Cook

Reply all
Reply to author
Forward
0 new messages