You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/11/11 08:13:44 UTC

[GitHub] [pulsar] Anonymitaet opened a new pull request #12745: [Doc] add explanations for subscription mode

Anonymitaet opened a new pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745


   Add docs for https://github.com/apache/pulsar/pull/10817


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijia-w commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
sijia-w commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r748846831



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -316,10 +316,11 @@ A subscription is a named configuration rule that determines how messages are de
 > * If you want to achieve "message queuing" among consumers, share the same subscription name among multiple consumers(shared, failover, key_shared).
 > * If you want to achieve both effects simultaneously, combine exclusive subscription type with other subscription types for consumers.
 
-### Consumerless Subscriptions and Their Corresponding Types
+### Subscriptions type

Review comment:
       Shall we use `Subscription types` instead?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r748992955



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -316,10 +316,11 @@ A subscription is a named configuration rule that determines how messages are de
 > * If you want to achieve "message queuing" among consumers, share the same subscription name among multiple consumers(shared, failover, key_shared).
 > * If you want to achieve both effects simultaneously, combine exclusive subscription type with other subscription types for consumers.
 
-### Consumerless Subscriptions and Their Corresponding Types
+### Subscriptions type

Review comment:
       Ah, yes, thanks for reminding me, can you update it in your PR https://github.com/apache/pulsar/pull/12794? thanks




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r747319331



##########
File path: site2/docs/admin-api-topics.md
##########
@@ -1464,3 +1440,90 @@ If a message has a key, it supersedes the round robin routing policy. The follow
             return signSafeMod(PARTITION_INDEX_UPDATER.getAndIncrement(this), topicMetadata.numPartitions());
         }
 ```        
+
+## Manage subscriptions
+
+You can use [Pulsar admin API](admin-api-overview.md) to create, check, and delete subscriptions.
+
+### Create subscription
+
+You can create a subscription for a topic using one of the following methods.
+
+<!--DOCUSAURUS_CODE_TABS-->
+
+<!--pulsar-admin-->
+
+```shell
+pulsar-admin topics create-subscription \
+--subscription my-subscription \
+persistent://test-tenant/ns1/tp1
+```
+
+<!--REST API-->
+
+{@inject: endpoint|PUT|/admin/v2/persistent/:tenant/:namespace/:topic/subscription/:subscription|operation/createSubscriptions?version=[[pulsar:version_number]]}
+
+<!--Java-->
+
+```java
+String topic = "persistent://my-tenant/my-namespace/my-topic";
+String subscriptionName = "my-subscription";
+admin.topics().createSubscription(topic, subscriptionName, MessageId.latest);
+```
+
+<!--END_DOCUSAURUS_CODE_TABS-->
+
+### Get subscription
+
+You can check all subscription names for a given topic using one of the following methods.
+
+<!--DOCUSAURUS_CODE_TABS-->
+
+<!--pulsar-admin-->
+
+```shell
+pulsar-admin topics subscriptions \
+persistent://test-tenant/ns1/tp1 \
+my-subscription
+```
+
+<!--REST API-->
+
+{@inject: endpoint|GET|/admin/v2/:schema/:tenant/:namespace/:topic/subscriptions|operation/getSubscriptions?version=[[pulsar:version_number]]}
+
+<!--Java-->
+
+```java
+String topic = "persistent://my-tenant/my-namespace/my-topic";
+admin.topics().getSubscriptions(topic);
+```
+
+<!--END_DOCUSAURUS_CODE_TABS-->
+
+### Delete (unsubscribe) subscription 

Review comment:
       Just use `Delete subscription` or keep the original `Unsubscribe` as the title.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijia-w commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
sijia-w commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r748846964



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -396,6 +397,57 @@ producer = client.create_producer(topic='my-topic', batching_type=pulsar.Batchin
 > * You need to specify a key or orderingKey for messages.
 > * You cannot use cumulative acknowledgment with Key_Shared type.
 
+### Subscription mode

Review comment:
       This heading should be in the same format of `Subscription types`. I suggest we use `Subscription modes`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui merged pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijia-w commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
sijia-w commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r748847043



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -396,6 +397,57 @@ producer = client.create_producer(topic='my-topic', batching_type=pulsar.Batchin
 > * You need to specify a key or orderingKey for messages.
 > * You cannot use cumulative acknowledgment with Key_Shared type.
 
+### Subscription mode
+
+#### What is subscription mode

Review comment:
       Here, we should either use `a subscription mode` or `subscription modes`. @Anonymitaet 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r748993228



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -396,6 +397,57 @@ producer = client.create_producer(topic='my-topic', batching_type=pulsar.Batchin
 > * You need to specify a key or orderingKey for messages.
 > * You cannot use cumulative acknowledgment with Key_Shared type.
 
+### Subscription mode
+
+#### What is subscription mode

Review comment:
       `subscription modes`
   
   can you update it in your PR #12794? thanks




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet edited a comment on pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
Anonymitaet edited a comment on pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#issuecomment-966788584


   Hi @sijia-w I've added explanations for the subscription mode in this PR. Can you help make the same changes to the following doc versions? Thanks
   
   - 2.7.0,2.7.1,2.7.2,2.7.3,2.8.0,2.8.1,2.8.2 in `website/versioned_docs` folder
   
   - 2.7.1, 2.7.2, 2.7.3, 2.8.0 in `website-next/versioned_docs` folder
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijia-w commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
sijia-w commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r748846831



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -316,10 +316,11 @@ A subscription is a named configuration rule that determines how messages are de
 > * If you want to achieve "message queuing" among consumers, share the same subscription name among multiple consumers(shared, failover, key_shared).
 > * If you want to achieve both effects simultaneously, combine exclusive subscription type with other subscription types for consumers.
 
-### Consumerless Subscriptions and Their Corresponding Types
+### Subscriptions type

Review comment:
       Shall we use `Subscription types` instead?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r748993006



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -396,6 +397,57 @@ producer = client.create_producer(topic='my-topic', batching_type=pulsar.Batchin
 > * You need to specify a key or orderingKey for messages.
 > * You cannot use cumulative acknowledgment with Key_Shared type.
 
+### Subscription mode

Review comment:
       Subscription modes 

##########
File path: site2/docs/concepts-messaging.md
##########
@@ -396,6 +397,57 @@ producer = client.create_producer(topic='my-topic', batching_type=pulsar.Batchin
 > * You need to specify a key or orderingKey for messages.
 > * You cannot use cumulative acknowledgment with Key_Shared type.
 
+### Subscription mode

Review comment:
       Yes, `Subscription modes`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#issuecomment-966788584


   Hi @sijia-w I've added explanations for the subscription mode in this PR. Can you help make the same changes to the following doc versions? Thanks
   
   - 2.7.0,2.7.1,2.7.2,2.7.3,2.8.0,2.8.1,2.8.2 in `website/versioned_docs` folder
   
   - 2.7.1, 2.7.2, 2.7.3, 2.8.0 in `website-next/docs` folder
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r748993006



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -396,6 +397,57 @@ producer = client.create_producer(topic='my-topic', batching_type=pulsar.Batchin
 > * You need to specify a key or orderingKey for messages.
 > * You cannot use cumulative acknowledgment with Key_Shared type.
 
+### Subscription mode

Review comment:
       Yes, `Subscription modes`
   
   can you update it in your PR #12794? thanks




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r747324104



##########
File path: site2/docs/admin-api-topics.md
##########
@@ -1464,3 +1440,90 @@ If a message has a key, it supersedes the round robin routing policy. The follow
             return signSafeMod(PARTITION_INDEX_UPDATER.getAndIncrement(this), topicMetadata.numPartitions());
         }
 ```        
+
+## Manage subscriptions
+
+You can use [Pulsar admin API](admin-api-overview.md) to create, check, and delete subscriptions.
+
+### Create subscription
+
+You can create a subscription for a topic using one of the following methods.
+
+<!--DOCUSAURUS_CODE_TABS-->
+
+<!--pulsar-admin-->
+
+```shell
+pulsar-admin topics create-subscription \
+--subscription my-subscription \
+persistent://test-tenant/ns1/tp1
+```
+
+<!--REST API-->
+
+{@inject: endpoint|PUT|/admin/v2/persistent/:tenant/:namespace/:topic/subscription/:subscription|operation/createSubscriptions?version=[[pulsar:version_number]]}
+
+<!--Java-->
+
+```java
+String topic = "persistent://my-tenant/my-namespace/my-topic";
+String subscriptionName = "my-subscription";
+admin.topics().createSubscription(topic, subscriptionName, MessageId.latest);
+```
+
+<!--END_DOCUSAURUS_CODE_TABS-->
+
+### Get subscription
+
+You can check all subscription names for a given topic using one of the following methods.
+
+<!--DOCUSAURUS_CODE_TABS-->
+
+<!--pulsar-admin-->
+
+```shell
+pulsar-admin topics subscriptions \
+persistent://test-tenant/ns1/tp1 \
+my-subscription
+```
+
+<!--REST API-->
+
+{@inject: endpoint|GET|/admin/v2/:schema/:tenant/:namespace/:topic/subscriptions|operation/getSubscriptions?version=[[pulsar:version_number]]}
+
+<!--Java-->
+
+```java
+String topic = "persistent://my-tenant/my-namespace/my-topic";
+admin.topics().getSubscriptions(topic);
+```
+
+<!--END_DOCUSAURUS_CODE_TABS-->
+
+### Delete (unsubscribe) subscription 

Review comment:
       OK, I prefer `Unsubscribe`. I've updated the PR, PTAL. @BewareMyPower 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijia-w commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
sijia-w commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r748846831



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -316,10 +316,11 @@ A subscription is a named configuration rule that determines how messages are de
 > * If you want to achieve "message queuing" among consumers, share the same subscription name among multiple consumers(shared, failover, key_shared).
 > * If you want to achieve both effects simultaneously, combine exclusive subscription type with other subscription types for consumers.
 
-### Consumerless Subscriptions and Their Corresponding Types
+### Subscriptions type

Review comment:
       Shall we use `Subscription Types` instead?

##########
File path: site2/docs/concepts-messaging.md
##########
@@ -396,6 +397,57 @@ producer = client.create_producer(topic='my-topic', batching_type=pulsar.Batchin
 > * You need to specify a key or orderingKey for messages.
 > * You cannot use cumulative acknowledgment with Key_Shared type.
 
+### Subscription mode

Review comment:
       This heading should be in the same format of `Subscription Types`. I suggest we use `Subscription Modes`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r747316777



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -396,6 +397,57 @@ producer = client.create_producer(topic='my-topic', batching_type=pulsar.Batchin
 > * You need to specify a key or orderingKey for messages.
 > * You cannot use cumulative acknowledgment with Key_Shared type.
 
+### Subscription mode
+
+#### What is subscription mode
+
+The subscription mode indicates the cursor type. 
+
+- When a subscription is created, an associated cursor is created to record the last consumed position. 
+

Review comment:
       I think no blank line is needed for a list in markdown.
   
   ```
   - line 01
   - line 02
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r747319912



##########
File path: site2/docs/admin-api-topics.md
##########
@@ -1464,3 +1440,90 @@ If a message has a key, it supersedes the round robin routing policy. The follow
             return signSafeMod(PARTITION_INDEX_UPDATER.getAndIncrement(this), topicMetadata.numPartitions());
         }
 ```        
+
+## Manage subscriptions
+
+You can use [Pulsar admin API](admin-api-overview.md) to create, check, and delete subscriptions.
+
+### Create subscription
+
+You can create a subscription for a topic using one of the following methods.
+
+<!--DOCUSAURUS_CODE_TABS-->
+
+<!--pulsar-admin-->
+
+```shell
+pulsar-admin topics create-subscription \
+--subscription my-subscription \
+persistent://test-tenant/ns1/tp1
+```
+
+<!--REST API-->
+
+{@inject: endpoint|PUT|/admin/v2/persistent/:tenant/:namespace/:topic/subscription/:subscription|operation/createSubscriptions?version=[[pulsar:version_number]]}
+
+<!--Java-->
+
+```java
+String topic = "persistent://my-tenant/my-namespace/my-topic";
+String subscriptionName = "my-subscription";
+admin.topics().createSubscription(topic, subscriptionName, MessageId.latest);
+```
+
+<!--END_DOCUSAURUS_CODE_TABS-->
+
+### Get subscription
+
+You can check all subscription names for a given topic using one of the following methods.
+
+<!--DOCUSAURUS_CODE_TABS-->
+
+<!--pulsar-admin-->
+
+```shell
+pulsar-admin topics subscriptions \
+persistent://test-tenant/ns1/tp1 \
+my-subscription
+```
+
+<!--REST API-->
+
+{@inject: endpoint|GET|/admin/v2/:schema/:tenant/:namespace/:topic/subscriptions|operation/getSubscriptions?version=[[pulsar:version_number]]}
+
+<!--Java-->
+
+```java
+String topic = "persistent://my-tenant/my-namespace/my-topic";
+admin.topics().getSubscriptions(topic);
+```
+
+<!--END_DOCUSAURUS_CODE_TABS-->
+
+### Delete (unsubscribe) subscription 
+
+When a subscription does not process messages any more, you can delete (unsubscribe) using one of the following methods. 
+
+<!--DOCUSAURUS_CODE_TABS-->
+
+<!--pulsar-admin-->
+
+```shell
+pulsar-admin topics unsubscribe \
+--subscription my-subscription \
+persistent://test-tenant/ns1/tp1 \

Review comment:
       ```suggestion
   persistent://test-tenant/ns1/tp1
   ```
   
   `\` is to separated multiple lines in a shell command. But it should not appear at the tail




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r747320344



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -396,6 +397,57 @@ producer = client.create_producer(topic='my-topic', batching_type=pulsar.Batchin
 > * You need to specify a key or orderingKey for messages.
 > * You cannot use cumulative acknowledgment with Key_Shared type.
 
+### Subscription mode
+
+#### What is subscription mode
+
+The subscription mode indicates the cursor type. 
+
+- When a subscription is created, an associated cursor is created to record the last consumed position. 
+

Review comment:
       Yes, but I insert a blank line to make things more clear. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Anonymitaet commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r747324639



##########
File path: site2/docs/admin-api-topics.md
##########
@@ -1464,3 +1440,90 @@ If a message has a key, it supersedes the round robin routing policy. The follow
             return signSafeMod(PARTITION_INDEX_UPDATER.getAndIncrement(this), topicMetadata.numPartitions());
         }
 ```        
+
+## Manage subscriptions
+
+You can use [Pulsar admin API](admin-api-overview.md) to create, check, and delete subscriptions.
+
+### Create subscription
+
+You can create a subscription for a topic using one of the following methods.
+
+<!--DOCUSAURUS_CODE_TABS-->
+
+<!--pulsar-admin-->
+
+```shell
+pulsar-admin topics create-subscription \
+--subscription my-subscription \
+persistent://test-tenant/ns1/tp1
+```
+
+<!--REST API-->
+
+{@inject: endpoint|PUT|/admin/v2/persistent/:tenant/:namespace/:topic/subscription/:subscription|operation/createSubscriptions?version=[[pulsar:version_number]]}
+
+<!--Java-->
+
+```java
+String topic = "persistent://my-tenant/my-namespace/my-topic";
+String subscriptionName = "my-subscription";
+admin.topics().createSubscription(topic, subscriptionName, MessageId.latest);
+```
+
+<!--END_DOCUSAURUS_CODE_TABS-->
+
+### Get subscription
+
+You can check all subscription names for a given topic using one of the following methods.
+
+<!--DOCUSAURUS_CODE_TABS-->
+
+<!--pulsar-admin-->
+
+```shell
+pulsar-admin topics subscriptions \
+persistent://test-tenant/ns1/tp1 \
+my-subscription
+```
+
+<!--REST API-->
+
+{@inject: endpoint|GET|/admin/v2/:schema/:tenant/:namespace/:topic/subscriptions|operation/getSubscriptions?version=[[pulsar:version_number]]}
+
+<!--Java-->
+
+```java
+String topic = "persistent://my-tenant/my-namespace/my-topic";
+admin.topics().getSubscriptions(topic);
+```
+
+<!--END_DOCUSAURUS_CODE_TABS-->
+
+### Delete (unsubscribe) subscription 
+
+When a subscription does not process messages any more, you can delete (unsubscribe) using one of the following methods. 
+
+<!--DOCUSAURUS_CODE_TABS-->
+
+<!--pulsar-admin-->
+
+```shell
+pulsar-admin topics unsubscribe \
+--subscription my-subscription \
+persistent://test-tenant/ns1/tp1 \

Review comment:
       Oops, yes. Updated.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijia-w commented on a change in pull request #12745: [Doc] add explanations for subscription mode

Posted by GitBox <gi...@apache.org>.
sijia-w commented on a change in pull request #12745:
URL: https://github.com/apache/pulsar/pull/12745#discussion_r749361799



##########
File path: site2/docs/concepts-messaging.md
##########
@@ -396,6 +397,57 @@ producer = client.create_producer(topic='my-topic', batching_type=pulsar.Batchin
 > * You need to specify a key or orderingKey for messages.
 > * You cannot use cumulative acknowledgment with Key_Shared type.
 
+### Subscription mode
+
+#### What is subscription mode

Review comment:
       Done.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org