SendMessage_微消息队列 MQTT_API文档

插件下载了解更多
VS Code 插件
安装插件之前,确保已安装 VS Code安装插件之前,确保已安装 VS Code
Alibaba Cloud Developer Toolkit is a collection of extensions that can help access Alibaba Cloud services in Visual Studio Code.
JetBrains 插件
安装插件之前,确保已安装 JetBrains IDE安装插件之前,确保已安装 JetBrains IDE
The Alibaba Cloud Developer Toolkit for JetBrains makes it easier to access Alibaba Cloud services.

接口说明

  • SendMessage 接口为服务端应用调用,与 MQTT 客户端发送消息互补。服务端和客户端的使用场景区别,请参见开发指南使用指引
  • 调用 SendMessage 接口发送的消息不支持流转至云消息队列 RocketMQ 版。若需要通过 MQTT 服务端将消息流转至云消息队列 RocketMQ 版,请使用 SDK 发送消息SendMessage 接口的 QPS 限制为 1000。更多信息,请参见 QPS 限制
  • 每成功调用一次 SendMessage 接口,都会计算为一次消息 TPS,从而影响您的计费。计费详情,请参见计费说明

流控信息

请求速率为1000/1(s)。

授权信息

当前云产品暂无权限信息透出。

请求参数

字段名称字段详情
MqttTopicstring

云消息队列 MQTT 版的 Topic,即消息发送的目标 Topic。

示例值:TopicA
InstanceIdstring

云消息队列 MQTT 版实例的 ID,一定要和客户端实际使用的实例 ID 匹配。您可以在控制台实例详情页面的基础信息区域查看。

示例值:post-cn-0pp12gl****参考取值来源:
    ListInstances
Payloadstring

消息内容,即消息负载。建议自行做 Base64 编码,避免传输不可见字符。

示例值:test

请求说明

说明 更多参数说明请参见公共参数服务接入点

返回参数

字段名称字段详情
MsgIdstring

消息的唯一标识,消息发送成功后服务端会返回消息 ID。

示例值:0B736D997B7F45FF54E61C1C1B58****
RequestIdstring

公共参数,每个请求的 ID 都是唯一的。

示例值:020F6A43-19E6-4B6E-B846-44EB31DF****

返回示例

错误码

全局错误码
HTTP 状态码错误码错误信息操作
400
CheckAccountInfoFailed
An error occurred while checking the account information by the STS token.诊断
400
InstancePermissionCheckFailed
An error occurred while validating the permissions of the instance. Please verify the account that created the instance and its permissions settings.诊断
400
ParameterCheckFailed
An error occurred while validating the parameters. The parameters may be missing or invalid.诊断
400
PermissionCheckFailed
An error occurred while validating the resource permissions. Please check the account that created the instance, topic, and GroupId, and check their permission settings.诊断
400
InvalidParameter.%s
An error occurred while validating the parameter. The parameter may be missing or invalid.诊断
404
ApiNotSupport
The specified API is not supported.诊断
500
InternalError
An error occurred while processing your request. Try again later.诊断
500
SendMessageFailed
A storage exception occurred while sending the message. Please try again.诊断
500
SystemOverFlow
An error occurred while processing your request. Please try again.诊断

变更历史

暂无变更历史

相关示例