ragaur-tibco opened a new issue, #22529:
URL: https://github.com/apache/pulsar/issues/22529

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Read release policy
   
   - [X] I understand that unsupported versions don't get bug fixes. I will 
attempt to reproduce the issue on a supported version of Pulsar client and 
Pulsar broker.
   
   
   ### Version
   
   3.2.2
   
   ### Minimal reproduce step
   
   Steps to reproduce:
   
   - send messages to multiple topics using producer 
   - consumer provide the regex pattern topic name: 
**non-persistent://my-tenant/new-name.*** 
   - provide the subscriptionTopicsMode = AllTopics
   
   ### What did you expect to see?
   
   - Consumer should be able to consume messages from the topic starts with 
**non-persistent://my-tenant/new-name**
   
   ### What did you see instead?
   
   - Consumer was able to consume messages from the topic starts with 
persistent as well 
   
   `package Pulsar;
   
   import org.apache.pulsar.client.admin.PulsarAdmin;
   import org.apache.pulsar.client.admin.PulsarAdminException;
   import org.apache.pulsar.client.api.*;
   
   import java.util.List;
   import java.util.concurrent.TimeUnit;
   import java.util.regex.Pattern;
   
   public class AllTopicsConsumerExample {
        private static PulsarAdmin adm;
       private static final String SERVICE_URL = "pulsar://localhost:6650";
       private static final String NAMESPACE = "my-tenant/new-name";
       private static final String SUBSCRIPTION_NAME = "your-subscription";
   
       public static void main(String[] args) throws PulsarClientException {
           PulsarClient pulsarClient = PulsarClient.builder()
                   .serviceUrl(SERVICE_URL)
                   .build();
           
           Producer<String> producer = pulsarClient.newProducer(Schema.STRING)
                   .topic("non-persistent://my-tenant/new-name/topic-non-1")
                   .enableBatching(false).create();
           producer.send("=========from topic 
non-persistent://my-tenant/new-name/topic-non-1 ");
           System.out.println("new producer");
           Producer<String> producer1 = pulsarClient.newProducer(Schema.STRING)
                   .topic("persistent://my-tenant/new-name/topic-pers-1")
                   .enableBatching(false).create();
           producer1.send("=======from topic 
persistent://my-tenant/new-name/topic-pers-1 ");
           
           Pattern allTopicsPattern = 
Pattern.compile("non-persistent://my-tenant/new-name/.*");
   
           Consumer<byte[]> allTopicsConsumer = pulsarClient.newConsumer()
                   .topicsPattern(allTopicsPattern)
                   
.subscriptionName(SUBSCRIPTION_NAME).subscriptionTopicsMode(RegexSubscriptionMode.valueOf("AllTopics"))
                   .subscribe();
   
           while (true) {
               Message<byte[]> message = allTopicsConsumer.receive();
               System.out.println("Received message from topic " + 
message.getTopicName()
                       + ": " + new String(message.getValue()));
               allTopicsConsumer.acknowledge(message);
           }
       }
   }
   
   
   `
   
![image](https://github.com/apache/pulsar/assets/119859927/e72d984a-60c2-4ffe-b72f-f91579919c8a)
   
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to