RobertIndie commented on issue #20637:
URL: https://github.com/apache/pulsar/issues/20637#issuecomment-1630271484

   I can't reproduce it.
   Could you provide your reproducible code?
   
   Here is my code:
   ```python
       def test_failover(self):
           def listener(consumer, msg):
               print("Got message: %s" % msg.value())
               consumer.acknowledge(msg)
           client = Client(self.serviceUrl)
           topic = 'test_failover'
           producer = client.create_producer(topic)
           consumer1 = client.subscribe(topic, 'my-sub', 
consumer_type=ConsumerType.Failover, message_listener=listener)
           consumer2 = client.subscribe(topic, 'my-sub', 
consumer_type=ConsumerType.Failover, message_listener=listener)
           msg_id = producer.send('hello'.encode())
           producer.flush()
           time.sleep(5)
           client.close()
   ```
   But it works fine. Only 1 consumer can consume the message:
   ```
   2023-07-11 07:08:44.268 INFO  [140120877363648] ClientConnection:184 | 
[<none> -> pulsar://localhost:6650] Create ClientConnection, timeout=10000
   2023-07-11 07:08:44.268 INFO  [140120877363648] ConnectionPool:106 | Created 
connection for pulsar://localhost:6650
   2023-07-11 07:08:44.270 INFO  [140120822662720] ClientConnection:382 | 
[127.0.0.1:42962 -> 127.0.0.1:6650] Connected to broker
   2023-07-11 07:08:44.272 INFO  [140120822662720] HandlerBase:72 | 
[persistent://public/default/test_failover, ] Getting connection from pool
   2023-07-11 07:08:44.274 INFO  [140120822662720] ProducerImpl:208 | 
[persistent://public/default/test_failover, ] Created producer on broker 
[127.0.0.1:42962 -> 127.0.0.1:6650] 
   2023-07-11 07:08:44.275 INFO  [140120877363648] Client:90 | Subscribing on 
Topic :test_failover
   2023-07-11 07:08:44.276 INFO  [140120822662720] HandlerBase:72 | 
[0x560d43cba760, my-sub, 0] Getting connection from pool
   2023-07-11 07:08:44.278 INFO  [140120822662720] ConsumerImpl:282 | 
[0x560d43cba760, my-sub, 0] Created consumer on broker [127.0.0.1:42962 -> 
127.0.0.1:6650] 
   2023-07-11 07:08:44.278 INFO  [140120877363648] Client:90 | Subscribing on 
Topic :test_failover
   2023-07-11 07:08:44.279 INFO  [140120822662720] HandlerBase:72 | 
[0x7f7064005720, my-sub, 1] Getting connection from pool
   2023-07-11 07:08:44.282 INFO  [140120822662720] ConsumerImpl:282 | 
[0x7f7064005720, my-sub, 1] Created consumer on broker [127.0.0.1:42962 -> 
127.0.0.1:6650] 
   Got message: b'hello'
   2023-07-11 07:08:49.288 INFO  [140120877363648] ClientImpl:599 | Closing 
Pulsar client with 1 producers and 2 consumers
   2023-07-11 07:08:49.288 INFO  [140120877363648] ProducerImpl:755 | 
[persistent://public/default/test_failover, standalone-0-1] Closing producer 
for topic 0x7f7064002e40
   2023-07-11 07:08:49.288 INFO  [140120877363648] ConsumerImpl:1229 | 
[0x7f7064005720, my-sub, 1] Closing consumer for topic 0x7f7064005720
   2023-07-11 07:08:49.289 INFO  [140120877363648] ConsumerImpl:1229 | 
[0x560d43cba760, my-sub, 0] Closing consumer for topic 0x560d43cba760
   2023-07-11 07:08:49.290 INFO  [140120822662720] ProducerImpl:719 | 
[persistent://public/default/test_failover, standalone-0-1] Closed producer 0
   2023-07-11 07:08:49.290 INFO  [140120822662720] ConsumerImpl:1215 | 
[0x7f7064005720, my-sub, 1] Closed consumer 1
   2023-07-11 07:08:49.291 INFO  [140120822662720] ConsumerImpl:1215 | 
[0x560d43cba760, my-sub, 0] Closed consumer 0
   2023-07-11 07:08:49.291 INFO  [140120797484608] ClientConnection:1229 | 
[127.0.0.1:42962 -> 127.0.0.1:6650] Connection disconnected
   2023-07-11 07:08:49.291 INFO  [140120797484608] ClientConnection:263 | 
[127.0.0.1:42962 -> 127.0.0.1:6650] Destroyed connection
   2023-07-11 07:08:49.291 INFO  [140120877363648] ProducerImpl:712 | Producer 
- [persistent://public/default/test_failover, standalone-0-1] , [batching  = 
off]
   .
   ----------------------------------------------------------------------
   Ran 1 test in 5.024s
   
   OK
   ```


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