You need to enable JavaScript to run this app.
文档中心
消息队列 RocketMQ版

消息队列 RocketMQ版

复制全文
下载 pdf
Topic管理
MessageSend - 发送消息
复制全文
下载 pdf
MessageSend - 发送消息
调用 MessageSend 接口,向指定 Topic 发送普通消息,验证消息发送链路是否通畅。​
使用说明​
此接口用于向指定 Topic 发送消息,验证消息发送链路是否通畅。消息发送后,您可以调用消息查询接口,校验消息是否成功发送到服务端。​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。​
Action string 必选 示例值:MessageSend​
要执行的操作,取值:MessageSend。​
​
Version string 必选 示例值:2023-01-01​
API的版本,取值:2023-01-01。​
​
Topic string 必选 示例值:topic-1​
目标 Topic 的名称,即向该 Topic 发送消息。​
​
Tag string 可选 示例值:TagA​
自定义设置消息 Tag。​
可以用来进一步对某个 Topic 下的消息进行分类,RocketMQ 允许消费者按照 Tag 对消息进行过滤。​
​
Key string 可选 示例值:key-1​
需要发送的消息的 Message Key。​
消息发送后,您可以通过 Message Key 来查询消息。​
​
Body string 必选 示例值:Hello world​
需要发送的消息的具体内容。​
​
Properties string[] 可选 示例值:/​
消息属性。​
​
InstanceId string 必选 示例值:rocketmq-cna****​
实例 ID。​
​
​
​
返回参数​
下方仅列出本接口特有的返回参数。更多信息请参见返回结构。​
Msgqueue object 示例值:/​
队列信息。​
BrokerName string 示例值:/​
Broker 组名。​
​
QueueId integer 示例值:/​
队列 ID。​
​
TopicName string 示例值:/​
Topic 名称。​
​
​
MsgId string 示例值:AC14B5D0000100****​
消息发送成功,返回每条消息的唯一 ID。可以通过消息 ID 查询消息。​
​
OffsetMsgId string 示例值:AC17E269000078BF**​
消息在服务端生成的 ID,主要包含了服务端地址和 commitlog offset。​
​
QeueueOffset integer 示例值:0​
消息在队列的 offset 位点。​
​
SendStatus string 示例值:SEND_OK​
消息发送结果状态。​
  • SEND_OK:发送成功​
  • SEND_FAIL:发送失败​
​
​
​
请求示例​
​
POST /?Action=MessageSend&Version=2023-01-01 HTTP/1.1​
Host: rocketmq.cn-beijing.volcengineapi.com​
Content-Type: application/json; charset=UTF-8​
X-Date: 20260112T031622Z​
X-Content-Sha256: 287e874e******d653b44d21e​
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20260112/cn-beijing/RocketMQ/request, SignedHeaders=host;x-content-sha256;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f​
​
{​
"Topic": "topic-1",​
"Body": "Hello world",​
"InstanceId": "rocketmq-cna****"​
}​
​
返回示例​
​
{​
"ResponseMetadata": {​
"RequestId": "202601121116312050510101692C****",​
"Action": "MessageSend",​
"Version": "2023-01-01",​
"Service": "RocketMQ",​
"Region": "cn-beijing"​
},​
"Result": {​
"Msgqueue": {​
"BrokerName": "/",​
"QueueId": 0,​
"TopicName": "/"​
},​
"MsgId": "AC14B5D0000100****",​
"OffsetMsgId": "AC17E269000078BF**",​
"QeueueOffset": 0,​
"SendStatus": "SEND_OK"​
}​
}​
​
错误码​
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。​
​
状态码​
错误码​
错误信息​
说明​
200​
OK​
OK​
成功。​
400​
InvalidPara​
The specified parameter is not valid.​
参数值无效。​
400​
MissingParameter​
The request body is missing a required parameter %s.​
缺少%s参数。​
400​
UnsupportedParameter​
The specified parameter %s is unsupported.​
不支持%s参数。​
400​
InvalidParameter​
The specified parameter %s is not valid.​
参数值%s无效,请检查后重试。​
400​
OperationDenied.InvalidRequest​
The request that you specified is not valid.​
请求异常,请检查后重试。​
403​
OperationDenied.AccountNotAuthorized​
You are not authorized to perform this operation.​
您不具备相关权限,请授权或切换账号后重试。​
403​
OperationDenied.ResourceOccupied​
The resource is busy now, please try again later.​
资源繁忙,可能由于指定资源正在被访问或回收。​
403​
OperationDenied.InvalidInstanceStatus​
The operation is not valid for the current status of the instance.​
当前实例状态不允许执行该操作。​
403​
OperationDenied.VersionUnsupported​
The current instance version does not support this operation.Please upgrade the instance and try again.​
当前实例版本不支持指定操作,请升级实例后再试。​
404​
InvalidInstanceId.NotFound​
The specified Instance ID does not exist.​
实例不存在。​
404​
InvalidTopicName.NotFound​
The specified topic does not exist.​
Topic 不存在。​
500​
ServerInternalError​
The request failed due to some unknown error, exception or failure.​
服务内部错误。​
500​
ResourceIsBusy​
The resource is busy now, please try again later.​
资源繁忙,可能由于指定资源正在被访问或回收。​
500​
InternalError​
The request failed due to some unknown error, exception or failure.​
内部错误,请稍后再试。​
503​
ServiceUnavailable​
The request failed due to a temporary failure of the server.​
当前服务暂时不可用。​
​
​
最近更新时间:2026.02.13 18:31:53
这个页面对您有帮助吗?
有用
有用
无用
无用