You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/09/23 15:51:04 UTC

[GitHub] [pulsar-client-node] savearray2 opened a new pull request #125: Adds Pattern/RegEx Support to Consumer

savearray2 opened a new pull request #125:
URL: https://github.com/apache/pulsar-client-node/pull/125


   Implements a quick-and-dirty hack to get RegEx support working for topics in consumers by spinning using ```std::this_thread::yield()``` in ```Napi::AsyncWorker```'s ```Execute``` function while waiting for callbacks. This allows the ```pulsar_client_subscribe_pattern_async``` and ```pulsar_client_subscribe_async``` functions to be used from the C++ library.


----------------------------------------------------------------
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-client-node] savearray2 commented on pull request #125: Adds Pattern/RegEx Support to Consumer

Posted by GitBox <gi...@apache.org>.
savearray2 commented on pull request #125:
URL: https://github.com/apache/pulsar-client-node/pull/125#issuecomment-702208980


   @hrsakai 
   Thank you for your response.
   
   I will make changes to use ```topicsPattern``` instead of the proposed ```subscriptionMode``` for this feature and notify you when I finish.


----------------------------------------------------------------
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-client-node] savearray2 commented on pull request #125: Adds Pattern/RegEx Support to Consumer

Posted by GitBox <gi...@apache.org>.
savearray2 commented on pull request #125:
URL: https://github.com/apache/pulsar-client-node/pull/125#issuecomment-702408336


   @hrsakai 
   Thank you for your time.
   
   I've completed the changes you've requested.
   The interface is now as follows:
   ```js
   const topicsPattern = 'persistent://public/default/produce-abc[a-z]ef';
   const consumer = await client.subscribe({
     topicsPattern,
     subscription: 'sub',
     subscriptionType: 'Shared',
   });
   ```
   
   Please let me know if you would like me to make any additional modifications.


----------------------------------------------------------------
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-client-node] hrsakai commented on pull request #125: Adds Pattern/RegEx Support to Consumer

Posted by GitBox <gi...@apache.org>.
hrsakai commented on pull request #125:
URL: https://github.com/apache/pulsar-client-node/pull/125#issuecomment-701886301


   @savearray2 
   Thank you for your contribution.
   
   Could you change the interface like other pulsar client libraries?
   ```
   const consumer = await client.subscribe({
     topicsPattern: 'persistent://public/default/produce-abc[a-z]ef',
   });
   ```
   
   golang
   http://pulsar.apache.org/docs/en/client-libraries-go/#receive-example
   ```
   topicsPattern := fmt.Sprintf("persistent://%s/foo.*", namespace)
   opts := ConsumerOptions{
       TopicsPattern:    topicsPattern,
       SubscriptionName: "regex-sub",
   }
   ```
   
   java
   http://pulsar.apache.org/docs/en/client-libraries-java/#multi-topic-subscriptions
   ```
   Pattern allTopicsInNamespace = Pattern.compile("persistent://public/default/.*");
   Consumer allTopicsConsumer = consumerBuilder
           .topicsPattern(allTopicsInNamespace)
           .subscribe();
   


----------------------------------------------------------------
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-client-node] hrsakai merged pull request #125: Adds Pattern/RegEx Support to Consumer

Posted by GitBox <gi...@apache.org>.
hrsakai merged pull request #125:
URL: https://github.com/apache/pulsar-client-node/pull/125


   


----------------------------------------------------------------
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-client-node] savearray2 commented on pull request #125: Adds Pattern/RegEx Support to Consumer

Posted by GitBox <gi...@apache.org>.
savearray2 commented on pull request #125:
URL: https://github.com/apache/pulsar-client-node/pull/125#issuecomment-697586887


   This may not be the best design for this feature, so please let me know your comments.
   
   Currently the API is set up in the following way:
   
   ```js
   const consumer = await client.subscribe({
     topic: 'persistent://public/default/produce-abc[a-z]ef',
     subscriptionMode: 'Pattern',
     subscription: 'sub',
     subscriptionType: 'Shared',
   });
   ````


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