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 2019/10/29 20:46:41 UTC

[GitHub] [pulsar] volfco edited a comment on issue #5274: geo replicated subscribers

volfco edited a comment on issue #5274: geo replicated subscribers
URL: https://github.com/apache/pulsar/issues/5274#issuecomment-547617424
 
 
   @sijie I've gotten a MVP cluster setup between two DCs that are ~40ms apart with replication between them.
   
   This is my code (I'm horrible at java):
   ```java
   import org.apache.pulsar.client.api.*;
   
   public class Main {
   
       public static void main(String[] args) throws Exception {
   
           if (args.length != 1) {
               System.out.println("Need serviceURL");
               System.exit(1);
           }
   
           PulsarClient client = PulsarClient.builder()
                   .serviceUrl(args[0])
                   .build();
   
           Consumer consumer = client.newConsumer()
                   .topic("persistent://development/ns1/test")
                   .subscriptionName("consumer")
                   .replicateSubscriptionState(true)
                   .subscribe();
   
           System.out.println("starting consumption");
           System.out.println(args[0]);
   
           while (true) {
               Thread.sleep(100);
               // Wait for a message
               Message msg = consumer.receive();
   
               try {
                   // Do something with the message
                   System.out.printf("Message received: %s\n", new String(msg.getData()));
   
                   // Acknowledge the message so that it can be deleted by the message broker
                   consumer.acknowledge(msg);
               } catch (Exception e) {
                   // Message failed to process, redeliver later
                   consumer.negativeAcknowledge(msg);
               }
           }
       }
   }
   ```
   
   Reading PIP-33, I'm operating under the assumption if I run one consumer reading from AUS, that consumer dies, and I start one reading from IAD a few seconds later, I shouldn't encounter many duplicate messages.
   
   This is not what I'm seeing. I can start the consumer in AUS, it'll start reading. I close it at message 10 and wait a few seconds and start an IAD consumer. It will start at the 0 position, and not around 10 like I would expect. If I restart the AUS consumer, it will pick up at message 10 and ignore any progress the IAD one has made.
   
   
   It also seems that this feature is almost what I'm looking for. From my understanding of PIP-33, I can only run one consumer at a time?

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


With regards,
Apache Git Services