gpt4 book ai didi

RabbitMQ - 发送 JSON 消息

转载 作者:行者123 更新时间:2023-12-02 21:47:01 26 4
gpt4 key购买 nike

我发送以下内容类型为 application/json 的消息:

enter image description here

但是,当我从同一个 RabbitMQ Web 控制台获取消息时,它会将有效负载显示为字符串。

enter image description here

我做错了什么?或者我从根本上误解了有效负载始终是字符串类型?

最佳答案

来自官方docs :

AMQP messages also have a payload (the data that they carry), which AMQP brokers treat as an opaque byte array. The broker will not inspect or modify the payload. It is possible for messages to contain only attributes and no payload. It is common to use serialisation formats like JSON, Thrift, Protocol Buffers and MessagePack to serialize structured data in order to publish it as the message payload. AMQP peers typically use the "content-type" and "content-encoding" fields to communicate this information, but this is by convention only.

所以基本上,RabbitMQ 不了解 JSON,消息都只是字节数组

关于RabbitMQ - 发送 JSON 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49788162/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com