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 2020/06/11 07:52:57 UTC

[GitHub] [pulsar] codelipenghui opened a new pull request #7240: Add tests and documentation for subscribing to non-persistent with topic pattern

codelipenghui opened a new pull request #7240:
URL: https://github.com/apache/pulsar/pull/7240


   Fixes #7205
   
   ### Motivation
   
   Add tests and documentation for subscribing to non-persistent with topic pattern
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (no)
   


----------------------------------------------------------------
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.

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



[GitHub] [pulsar] Anonymitaet commented on a change in pull request #7240: Add tests and documentation for subscribing to non-persistent with topic pattern

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



##########
File path: site2/docs/client-libraries-java.md
##########
@@ -379,18 +379,35 @@ ConsumerBuilder consumerBuilder = pulsarClient.newConsumer()
         .subscriptionName(subscription);
 
 // Subscribe to all topics in a namespace
-Pattern allTopicsInNamespace = Pattern.compile("persistent://public/default/.*");
+Pattern allTopicsInNamespace = Pattern.compile("public/default/.*");
 Consumer allTopicsConsumer = consumerBuilder
         .topicsPattern(allTopicsInNamespace)
         .subscribe();
 
 // Subscribe to a subsets of topics in a namespace, based on regex
-Pattern someTopicsInNamespace = Pattern.compile("persistent://public/default/foo.*");
+Pattern someTopicsInNamespace = Pattern.compile("public/default/foo.*");
 Consumer allTopicsConsumer = consumerBuilder
         .topicsPattern(someTopicsInNamespace)
         .subscribe();
 ```
 
+In the above example, the consumer subscribes to the `persistent` topics that can match the topic name pattern,
+If you want the consumer subscribes to all `persistent` and `non-persistent` topics that can match the topic pattern,
+You need to set `subscriptionTopicsMode` to `RegexSubscriptionMode.AllTopics`.
+
+```java
+Pattern pattern = Pattern.compile("public/default/.*");
+pulsarClient.newConsumer()
+        .subscriptionName("my-sub")
+        .topicsPattern(pattern)
+        .subscriptionTopicsMode(RegexSubscriptionMode.AllTopics)
+        .subscribe();
+```
+
+> Note:
+> 
+> By default, the `subscriptionTopicsMode` of the consumer is `PersistentOnly`. Available options are `PersistentOnly`, `NonPersistentOnly` and `AllTopics`

Review comment:
       ```suggestion
   > #### Note
   > 
   > By default, the `subscriptionTopicsMode` of the consumer is `PersistentOnly`. Available options of `subscriptionTopicsMode` are `PersistentOnly`, `NonPersistentOnly`, and `AllTopics`.
   ```

##########
File path: site2/docs/client-libraries-java.md
##########
@@ -379,18 +379,35 @@ ConsumerBuilder consumerBuilder = pulsarClient.newConsumer()
         .subscriptionName(subscription);
 
 // Subscribe to all topics in a namespace
-Pattern allTopicsInNamespace = Pattern.compile("persistent://public/default/.*");
+Pattern allTopicsInNamespace = Pattern.compile("public/default/.*");
 Consumer allTopicsConsumer = consumerBuilder
         .topicsPattern(allTopicsInNamespace)
         .subscribe();
 
 // Subscribe to a subsets of topics in a namespace, based on regex
-Pattern someTopicsInNamespace = Pattern.compile("persistent://public/default/foo.*");
+Pattern someTopicsInNamespace = Pattern.compile("public/default/foo.*");
 Consumer allTopicsConsumer = consumerBuilder
         .topicsPattern(someTopicsInNamespace)
         .subscribe();
 ```
 
+In the above example, the consumer subscribes to the `persistent` topics that can match the topic name pattern,
+If you want the consumer subscribes to all `persistent` and `non-persistent` topics that can match the topic pattern,
+You need to set `subscriptionTopicsMode` to `RegexSubscriptionMode.AllTopics`.

Review comment:
       ```suggestion
   In the above example, the consumer subscribes to the `persistent` topics that can match the topic name pattern. If you want the consumer subscribes to all `persistent` and `non-persistent` topics that can match the topic name pattern, set `subscriptionTopicsMode` to `RegexSubscriptionMode.AllTopics`.
   ```




----------------------------------------------------------------
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.

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



[GitHub] [pulsar] codelipenghui merged pull request #7240: Add tests and documentation for subscribing to non-persistent with topic pattern

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


   


----------------------------------------------------------------
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.

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



[GitHub] [pulsar] codelipenghui commented on pull request #7240: Add tests and documentation for subscribing to non-persistent with topic pattern

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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.

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



[GitHub] [pulsar] codelipenghui commented on pull request #7240: Add tests and documentation for subscribing to non-persistent with topic pattern

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


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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.

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