emqx_mgmt_api_publish { publish_api { desc { en: """ Publish one message.
Possible HTTP status response codes are:
200: The message is delivered to at least one subscriber;
202: No matched subscribers;
400: Message is invalid. for example bad topic name, or QoS is out of range;
503: Failed to deliver the message to subscriber(s);
""" zh: """ 发布一个消息。
可能的 HTTP 状态码如下:
200: 消息被成功发送到至少一个订阅。
202: 没有匹配到任何订阅。
400: 消息编码错误,如非法主题,或 QoS 超出范围等。
503: 服务重启等过程中导致转发失败。

""" } } publish_bulk_api { desc { en: """ Publish a batch of messages.
Possible HTTP response status code are:
200: All messages are delivered to at least one subscriber;
202: At least one message was not delivered to any subscriber;
400: At least one message is invalid. For example bad topic name, or QoS is out of range;
503: Failed to deliver at least one of the messages;
In case there is at lest one invalid message in the batch, the HTTP response body is the same as for /publish API.
Otherwise the HTTP response body is an array of JSON objects indicating the publish result of each individual message in the batch. """ zh: """ 批量发布一组消息。
可能的 HTTP 状态码如下:
200: 所有的消息都被成功发送到至少一个订阅。
202: 至少有一个消息没有匹配到任何订阅。
400: 至少有一个消息编码错误,如非法主题,或 QoS 超出范围等。
503: 至少有一个小因为服务重启的原因导致转发失败。
请求的 Body 或者 Body 中包含的某个消息无法通过 API 规范的类型检查时,HTTP 响应的消息与发布单个消息的 API /publish 是一样的。 如果所有的消息都是合法的,那么 HTTP 返回的内容是一个 JSON 数组,每个元素代表了该消息转发的状态。 """ } } topic_name { desc { en: "Topic Name" zh: "主题名称" } } qos { desc { en: "MQTT message QoS" zh: "MQTT 消息的 QoS" } } clientid { desc { en: "Each message can be published as if it is done on behalf of an MQTT client whos ID can be specified in this field." zh: "每个消息都可以带上一个 MQTT 客户端 ID,用于模拟 MQTT 客户端的发布行为。" } } payload { desc { en: "The MQTT message payload." zh: "MQTT 消息体。" } } retain { desc { en: "A boolean field to indicate if this message should be retained." zh: "布尔型字段,用于表示该消息是否保留消息。" } } payload_encoding { desc { en: "MQTT Payload Encoding, base64 or plain. When set to base64, the message is decoded before it is published." zh: "MQTT 消息体的编码方式,可以是 base64plain。当设置为 base64 时,消息在发布前会先被解码。" } } message_id { desc { en: "A globally unique message ID for correlation/tracing." zh: "全局唯一的一个消息 ID,方便用于关联和追踪。" } } reason_code { desc { en: """ The MQTT reason code, as the same ones used in PUBACK packet.
Currently supported codes are:
16(0x10): No matching subscribers;
131(0x81): Error happened when dispatching the message. e.g. during EMQX restart;
144(0x90): Topic name invalid;
151(0x97): Publish rate limited, or message size exceeded limit. The global size limit can be configured with mqtt.max_packet_size
NOTE: The message size is estimated with the received topic and payload size, meaning the actual size of serialized bytes (when sent to MQTT subscriber) might be slightly over the limit. """ zh: """ MQTT 消息发布的错误码,这些错误码也是 MQTT 规范中 PUBACK 消息可能携带的错误码。
当前支持如下错误码:
16(0x10):没能匹配到任何订阅;
131(0x81):消息转发时发生错误,例如 EMQX 服务重启;
144(0x90):主题名称非法;
151(0x97):受到了速率限制,或者消息尺寸过大。全局消息大小限制可以通过配置项 mqtt.max_packet_size 来进行修改。
注意:消息尺寸的是通过主题和消息体的字节数进行估算的。具体发布时所占用的字节数可能会稍大于这个估算的值。 """ } } error_message { desc { en: "Describes the failure reason in detail." zh: "失败的详细原因。" } } }