tencent cloud

CreateSubscription
마지막 업데이트 시간:2025-11-25 10:53:44
CreateSubscription
마지막 업데이트 시간: 2025-11-25 10:53:44

1. API Description

Domain name for API request: tdmq.intl.tencentcloudapi.com.

This API is used to create a subscription to a topic.

A maximum of 200 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateSubscription.
Version Yes String Common Params. The value used for this API: 2020-02-17.
Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-bangkok, ap-beijing, ap-chengdu, ap-chongqing, ap-guangzhou, ap-hongkong, ap-jakarta, ap-nanjing, ap-seoul, ap-shanghai, ap-shanghai-fsi, ap-shenzhen-fsi, ap-singapore, ap-tokyo, eu-frankfurt, na-ashburn, na-siliconvalley.
EnvironmentId Yes String Environment (namespace) name.
TopicName Yes String Topic name.
SubscriptionName Yes String Subscriber name, which can contain up to 128 characters.
IsIdempotent Yes Boolean Whether the creation is idempotent; if not, you cannot create subscriptions with the same name.
ClusterId Yes String Pulsar cluster ID
Remark No String Remarks (up to 128 characters).
AutoCreatePolicyTopic No Boolean Whether to automatically create a dead letter topic and a retry letter topic. true: yes (default value); false: no.
PostFixPattern No String Naming convention for dead letter and retry letter topics. LEGACY indicates to use the legacy naming convention, and COMMUNITY indicates to use the naming convention in the Pulsar community.

3. Output Parameters

Parameter Name Type Description
Result Boolean Creation result.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Create subscription relationship

Input Example

POST / HTTP/1.1
Host: tdmq.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateSubscription
<Common request parameters>

{
    "EnvironmentId": "devNs",
    "TopicName": "devTopic",
    "SubscriptionName": "devSub",
    "Remark": "devTest",
    "IsIdempotent": true,
    "ClusterId": "pulsar-5r59xd4vnx",
    "AutoCreatePolicyTopic": true,
    "PostFixPattern": "LEGACY"
}

Output Example

{
    "Response": {
        "Result": true,
        "RequestId": "15288803-dadb-4499-9b5b-ff2f631ca68e"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
AuthFailure.UnauthorizedOperation CAM authentication failed.
FailedOperation Operation failed.
FailedOperation.CloudService Third-Party cloud service exception. try again later.
FailedOperation.CreateSubscription Failed to create the subscription.
FailedOperation.GetTopicPartitionsFailed Failed to get the number of topic partitions.
FailedOperation.OperateLater Task in progress. please try again later.
FailedOperation.ReplicationDestCheckFailedError Cross-Region replication validation failed.
FailedOperation.ReplicationSourceCheckFailedError Cross-Region replication verification failed.
InternalError.Retry You can try again.
InternalError.SystemError System error.
InvalidParameterValue.InvalidParams The parameter value is out of the value range.
LimitExceeded.Subscriptions The number of subscribers under the instance exceeds the limit.
LimitExceeded.Topics The number of topics under the instance exceeds the limit.
ResourceInUse.Subscription A subscription with the same name already exists.
ResourceNotFound.BrokerCluster The service cluster does not exist.
ResourceNotFound.Cluster The cluster does not exist.
ResourceNotFound.Topic The topic does not exist.
ResourceUnavailable.FundRequired You must top up before proceeding.
문제 해결에 도움이 되었나요?
더 자세한 내용은 문의하기 또는 티켓 제출 을 통해 문의할 수 있습니다.
아니오

피드백