Modify subscription properties

Last updated: 2020-02-26 15:56:40

Interface description

This API (SetSubscriptionAttributes) is used to modify the attributes of message subscriptions.

  • Domain name requested by public network API: https://cmq-topic-{$region}.api.qcloud.com
  • Domain name requested by private network API: http://cmq-topic-{$region}.api.tencentyun.com

The above {$region} in the domain name needs to be replaced with a specific region : gz (Guangzhou), sh (Shanghai), bj (Beijing), shjr (Shanghai Financial), szjr (Shenzhen Financial), hk (China Hong Kong), cd (Chengdu), ca (North American), usw (Maxi), sg (Singapore). The region value in the common parameters should be consistent with the region value of the domain name. If there is any inconsistency, the request will be sent to the region specified by the domain name region based on the region value of the domain name.

At any time (including during internal testing), if the public network downstream Traffic is generated by using a public network domain name, Traffic and cost will be charged. Therefore, users of the service on Tencent Cloud are strongly recommended to use it. Private network Domain name, private network will not produce Traffic cost.

Input Parameter

The following request parameter list only lists the API request parameters. For other parameters, please see Common Request Parameters page.

Parameter name Required Type Description
TopicName Yes String Topic's name is unique under the same account in a single region. The name of topic is a string of no more than 64 characters, which must begin with a letter, and the rest can contain letters, numbers and underscores (-).
SubscriptionName Yes String The subscription name is unique under the same topic of the same account in a single region. The subscription name is a string of no more than 64 characters, must begin with a letter, and the rest can contain letters, numbers, and dashes (-).
NotifyStrategy No String The retry policy of the endpoint push server when an error occurs in the push message to CMQ. The values are as follows:
(1) BACKOFF_RETRY, Backoff retry. Try again at regular intervals, and after retrying a certain number of times, discard the message and continue to push the next message.
(2) EXPONENTIAL_DECAY_RETRY, index decline retry. The interval of each retry increases exponentially, for example, at the beginning of 1s, followed by 2sfocus 4s, 8s because the period of the Topic message is one day, so the message will be discarded for up to one day. The default value is EXPONENTIAL_DECAY_RETRY.
NotifyContentFormat No String The format of the push content. Value: (1) JSON; (2) SIMPLIFIED, is raw format. If protocol is queue, the value must be SIMPLIFIED. If protocol is HTTP, both values can be used, and the default value is JSON.
FilterTag.n No String Message body. Message label (for message filtering). The number of tags cannot exceed 5, and each label cannot exceed 16 characters. and (Batch) PublishMessage The msgTag parameter is used in conjunction with the following rules: (1) if filterTag is not set, subscriptions receive all messages from publish to Topic, regardless of whether msgTag is set or not;
(2) if the filterTag array has a value, the subscription will receive the message from publish to Topic only if at least one value in the array also exists in the msgTag array (that is, there is an intersection between filterTag and msgTag).
(3) if the filterTag array has a value, but msgTag is not set, then no messages from publish to Topic will be received, which can be regarded as a special case of (2). In this case, filterTag and msgTag do not intersect. The overall design idea of the rules is based on the wishes of the subscribers.
BindingKey.n Yes String array The number of bindingKey does not exceed 5, and each bindingKey is no more than 64 bytes long. This field represents the filtering policy for subscribing to receive messages. Each bindingKey contains a maximum of 15 ".", that is, a maximum of 16 phrases.

Output Parameter

Parameter name Type Description
Code Int 0: indicates success. Others: error. For more information, please see Common error code .
Message String Error message.
RequestId String Request ID generated by the server. When an internal error occurs on the server, the user can submit this ID to Backend Background to locate the problem.

Error Codes

Please check Common error code .

Example

Enter:

 https://domain/v2/index.php?Action=SetSubscriptionAttributes
 &topicName=test-Topic-123
 &subscriptionName=test-subscription-123
 &filterTag.0=football
 &<Common request parameters>

Output:

{
"code" : 0,
"message" : "",
"requestId":"14534664555"
}