How to send JSON payload to RabbitMQ using the web plugin?

前端 未结 2 1316
面向向阳花
面向向阳花 2021-02-07 10:06

I have a RabbitMQ 3.4.2 instance with a web management plugin installed.

When I push to the message {\'operationId\': 194} to the queue using Python\'s komb

2条回答
  •  清歌不尽
    2021-02-07 10:42

    You need to de-serialize the output.

    import json
    payload = json.loads(payload)
    operation_id = payload['operationId']
    

    In addition {'operationId': 194} is not valid JSON. Although it looks like you use double quotes in the screenshot, but make sure you replace the single quotes with double quotes.

    Edit: So you are correct, kombu should handle this. Looking at the code it's likely that the header is case-sensitive. Change the properties header from Content-Type to content-type.

提交回复
热议问题