【发布时间】:2018-02-01 12:21:42
【问题描述】:
我只是在使用 RabbitMQ,我尝试向它发送一个 json 有效负载。不幸的是,我遇到了错误:
{"error":"bad_request","reason":"payload_not_string"}
我在某处读到需要使用"content_type": "application/json",但这也无济于事。
这是我要发送的正文:
{
"properties": {
"delivery_mode": 2,
"content_type": "application/json"
},
"routing_key": "git",
"payload": {
"action": "created",
"comment": {
"url": "https://api.github.com/repos/baxterthehacker/public-repo/comments/11056394",
"id": 11056394
}
},
"payload_encoding": "string"
}
还有完整的卷曲:
curl -i -X POST \
-H "Content-Type:application/json" \
-H "Authorization:Basic Z3Vlc3Q6Z3Vlc3Q=" \
-d \
'{
"properties": {
"delivery_mode": 2,
"content_type": "application/json"
},
"routing_key": "git",
"payload": {
"action": "created",
"comment": {
"url": "https://api.github.com/repos/baxterthehacker/public-repo/comments/11056394",
"id": 11056394
}
},
"payload_encoding": "string"
}' \
'http://localhost:8090/api/exchanges/%2f/amq.topic/publish'
是否可以发送 json 有效负载?我正在考虑将 Github webhook 发送到其中一个队列。
【问题讨论】:
标签: rabbitmq rabbitmq-exchange