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 2022/03/11 02:50:41 UTC

[GitHub] [pulsar] 468120308 opened a new issue #14652: Subscription replication did not take effect

468120308 opened a new issue #14652:
URL: https://github.com/apache/pulsar/issues/14652


   #### Expected behavior
   
   I configured replication and subscription replication in two clusters (A, B). The application connects to cluster A to consume all messages of the specified topic, and then restarts the application to connect to cluster B. The same topic should not need to be consumed. 
   
   #### Actual behavior
   
   restarts the application to connect to cluster B. The same topic needs to be consumed repeatedly. Subscription replication did not take effect. 
   
   #### Steps to reproduce
   
      public static void main(String[] args) throws Exception {
           PulsarClient client = PulsarClient.builder()
                   .serviceUrl("pulsar://**********:6650")
                   .build();
   
           Producer producer = client.newProducer(Schema.BYTES)
                   .topic(topicName)
                   .create();
   
           Consumer consumer = client.newConsumer(Schema.BYTES)
                   .topic(topicName)
                   .subscriptionType(SubscriptionType.Shared).subscriptionName("test")
                   .replicateSubscriptionState(true)
                   .subscribe();
   
           producer.send("cxctest".getBytes(StandardCharsets.UTF_8));
           producer.send("cxctest2".getBytes(StandardCharsets.UTF_8));
           producer.send("cxctest3".getBytes(StandardCharsets.UTF_8));
   
           ConsumerDemo consumerDemo = new ConsumerDemo(client, consumer);
           consumerDemo.run();
       }
   
       static class ConsumerDemo implements Runnable {
   
           PulsarClient client ;
   
           Consumer consumer;
   
           public ConsumerDemo(PulsarClient client, Consumer consumer) {
               this.client = client;
               this.consumer = consumer;
           }
   
           @Override
           public void run() {
               try {
                   do {
                       Message msg = consumer.receive();
                       consumer.acknowledge(msg.getMessageId());
                       System.out.println(new String(msg.getData()));
                   } while (true);
               } catch (Exception e) {
                   System.out.println(Throwables.getStackTraceAsString(e));
               }
           }
       }
   
   #### System configuration
   **Pulsar version**: 2.7.2
   


-- 
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] 468120308 commented on issue #14652: Subscription replication did not take effect

Posted by GitBox <gi...@apache.org>.
468120308 commented on issue #14652:
URL: https://github.com/apache/pulsar/issues/14652#issuecomment-1068753863


   > Do you have enabled replication for cluster-A to cluster-B ,and cluster-B to cluster-A?
   
   yes. Topics can be replicated in both directions 


-- 
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 commented on issue #14652: Subscription replication did not take effect

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #14652:
URL: https://github.com/apache/pulsar/issues/14652#issuecomment-1066930251


   Do you have enabled replication for cluster-A to cluster-B ,and cluster-B to cluster-A?


-- 
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] Technoboy- commented on issue #14652: Subscription replication did not take effect

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on issue #14652:
URL: https://github.com/apache/pulsar/issues/14652#issuecomment-1071988854


   Hi, @468120308 , I will check. And reply later.


-- 
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] Technoboy- commented on issue #14652: Subscription replication did not take effect

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on issue #14652:
URL: https://github.com/apache/pulsar/issues/14652#issuecomment-1071988854


   Hi, @468120308 , I will check. And reply later.


-- 
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] Technoboy- commented on issue #14652: Subscription replication did not take effect

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on issue #14652:
URL: https://github.com/apache/pulsar/issues/14652#issuecomment-1083195692


   https://github.com/apache/pulsar/pull/14017 is not cherry-picked to branch-2.7.
   You can try to cherry-pick this patch to your local to test if this works.


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