Configures the read/write mode for a specified topic.

Note

This operation can be called to forbid read or write operations on a specific topic.

QPS 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 a second exceeds the queries per second (QPS) limit, throttling is triggered. This may interrupt your business. For information about the QPS limit of each operation, see API rate 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 with a namespace

Resource in an instance without a namespace

OnsTopicUpdate

mq:QueryInstanceBaseInfo

mq:UpdateTopic

acs:mq:*:*:{instanceId}%{topic}

acs:mq:*:*:{topic}

Request parameters

Parameter Type Required Example Description
Action String Yes OnsTopicUpdate

The operation that you want to perform. Set the value to OnsTopicUpdate.

Topic String Yes test

The name of the topic that you want to manage.

Perm Integer Yes 6

The read/write mode that you want to configure for the topic. Valid values:

  • 6: Both read and write operations are allowed.
  • 4: Write operations are forbidden.
  • 2: Read operations are forbidden.
InstanceId String Yes MQ_INST_111111111111_DOxxxxxx

The ID of the instance to which the topic belongs.

Response parameters

Parameter Type Example Description
RequestId String 81979ADA-4A78-4F64-9DEC-5700446D****

The ID of the request. The system generates a unique ID for each request. You can troubleshoot issues based on the request ID.

Example

Sample requests

http(s)://ons.cn-hangzhou.aliyuncs.com/?Action=OnsTopicUpdate
&Perm=6
&Topic=test
&InstanceId=MQ_INST_111111111111_DOxxxxxx
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<OnsTopicUpdateResponse>
<RequestId>81979ADA-4A78-4F64-9DEC-5700446D****</RequestId>
</OnsTopicUpdateResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "81979ADA-4A78-4F64-9DEC-5700446D****"
}

Error codes

For a list of error codes, visit the API Error Center.