【问题标题】:Sending a persistent message in RabbitMQ via HTTP API通过 HTTP API 在 RabbitMQ 中发送持久消息
【发布时间】:2016-09-01 05:41:30
【问题描述】:

我想通过 HTTP API 发送持久消息。我正在使用这个命令:

curl -u UN:PWD -H "content-type:application/json" -X POST -d'{"properties":{},"routing_key":"QueueName","payload":"HI","payload_encoding":"string", "deliverymode": 2}' http://url:8080/api/exchanges/%2f/amq.default/publish

我的队列是持久的,deliverymode 也设置为 2(Persistent),但发布的消息不是持久的。需要做哪些改变? 当我通过管理控制台发送相同的消息时,消息是持久的,但不是通过 HTTP API。

【问题讨论】:

    标签: api http rabbitmq persistent


    【解决方案1】:

    delivery_mode是一个属性,所以你必须把它放在"properties"里面:

    curl -u guest:guest -H "content-type:application/json" -X POST -d'{"properties":{"delivery_mode":2},"routing_key":"QueueName","payload":"HI","payload_encoding":"string"}' http://localhost:15672/api/exchanges/%2f/amq.default/publish
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-19
      • 1970-01-01
      • 2012-12-26
      • 1970-01-01
      • 2016-12-08
      • 1970-01-01
      相关资源
      最近更新 更多