Pushes a message to a specified consumer.
Note
This operation can be used to check whether messages in a specified topic can be consumed by consumers in a specified consumer group. This operation obtains the body of the message that is specified by the MsgId parameter, re-encapsulates the message body to produce a new message, and then pushes the new message to a specified consumer. The content of the message that is sent to the consumer is the same as the content of the original message. They are not the same message because they use different message IDs.
Request limit
Each Alibaba Cloud account can call this operation up to 10 times per second. If the number of requests that you send to call this operation within one second reaches the request limit, new requests fail. This may interrupt your business. For information about the request limit of each operation, see API request limits.
Authorization
By default, Alibaba Cloud accounts can call this operation. A Resource Access Management (RAM) user can call this operation only after the RAM user is granted the required permissions. The following table describes the permissions that must be granted to a RAM user to call this operation. For information about how to grant permissions, see Policies.
API |
Action |
Resource in an instance that uses a namespace |
Resource in an instance that does not use a namespace |
---|---|---|---|
OnsMessagePush |
mq:QueryInstanceBaseInfo mq:SUB |
acs:mq:*:*:{instanceId}%{topic} |
acs:mq:*:*:{topic} |
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | OnsMessagePush |
The operation that you want to perform. Set the value to OnsMessagePush. |
GroupId | String | Yes | GID_test_group_id |
The ID of the consumer group. For information about what a consumer group is, see Terms. |
ClientId | String | Yes | 30.5.121.**@24813#-1999745829#-1737591554#453111174894656 |
The ID of the consumer. You can call the OnsConsumerGetConnection operation to query the ID of each consumer in a consumer group. |
MsgId | String | Yes | 0BC1669963053CF68F733BB70396**** |
The ID of the message. |
Topic | String | Yes | test-mq_topic |
The topic to which the message is pushed. |
InstanceId | String | Yes | MQ_INST_111111111111_DOxxxxxx |
The ID of the Message Queue for Apache RocketMQ instance to which the specified consumer group belongs. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | B8EDC90D-F726-4B9E-8BEF-F0DD25EC**** |
The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID. |
Examples
Sample requests
http(s)://ons.cn-zhangjiakou.aliyuncs.com/?Action=OnsMessagePush
&GroupId=GID_test_group_id
&ClientId=30.5.121.**@24813#-1999745829#-1737591554#453111174894656
&MsgId=0BC1669963053CF68F733BB70396****
&Topic=test-mq_topic
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<OnsMessagePushResponse>
<RequestId>B8EDC90D-F726-4B9E-8BEF-F0DD25EC****</RequestId>
</OnsMessagePushResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "B8EDC90D-F726-4B9E-8BEF-F0DD25EC****"
}
Error codes
For a list of error codes, visit the API Error Center.