Search before asking
Version
Apache Pulsar Version - 2.11.1
Minimal reproduce step
The consumer is as below,
pulsarClient.newConsumer(Schema.JSON(Schedule.class)).ackTimeout(600000, TimeUnit.MILLISECONDS) .consumerName("test-consumer").topic(pulsarProperties.getTopic()) .subscriptionName("test-subscription") .subscriptionType(SubscriptionType.Shared) .deadLetterPolicy(DeadLetterPolicy.builder().maxRedeliverCount(5) .deadLetterTopic(pulsarProperties.getTopic() + "-dlq").build()) .autoUpdatePartitions(true).receiverQueueSize(2000) .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) .messageListener(consumer).subscribe();
What did you expect to see?
The consumer should consume a message only once & that is happening as expected most of the time.
But occasionally, The consumer is consuming the same message twice which is causing consistency issues with the application logic.
What did you see instead?
The consumer is consuming the same message twice which is causing consistency issues with the application logic.
I confirmed the same by logging the message ID in the consumed message.
2023-08-14 02:32:15.221 INFO [1a512eb2-2c23-4b91-bd2e-cc656df3a9c8] [] [pulsar-external-listener-12-1] [RecurringScheduledEventHandler.java:38] c.f.s.s.p.RecurringScheduledEventHandler - >> handling mesage ID 100260:12688:0 - pulsar-105-23
2023-08-14 02:32:15.225 INFO [720cf56f-9b4c-49f7-8f91-81c0fa9bba35] [] [pulsar-external-listener-12-1] [RecurringScheduledEventHandler.java:38] c.f.s.s.p.RecurringScheduledEventHandler - >> handling mesage ID 100260:12688:0 - pulsar-105-23
Here, The same message ID 100260:12688:0 is consumed by the same consumer thread pulsar-external-listener-12-1 within few ms by 1a512eb2-2c23-4b91-bd2e-cc656df3a9c8 & 720cf56f-9b4c-49f7-8f91-81c0fa9bba35
How come the listener pulsar-external-listener-12-1 processes the same messages twice at the same time? The ack is yet to happen for the thread 1a512eb2-2c23-4b91-bd2e-cc656df3a9c8 but before that the same message is consumer & processed by the thread 720cf56f-9b4c-49f7-8f91-81c0fa9bba35
Anything else?
No response
Are you willing to submit a PR?
Search before asking
Version
Apache Pulsar Version - 2.11.1
Minimal reproduce step
The consumer is as below,
pulsarClient.newConsumer(Schema.JSON(Schedule.class)).ackTimeout(600000, TimeUnit.MILLISECONDS) .consumerName("test-consumer").topic(pulsarProperties.getTopic()) .subscriptionName("test-subscription") .subscriptionType(SubscriptionType.Shared) .deadLetterPolicy(DeadLetterPolicy.builder().maxRedeliverCount(5) .deadLetterTopic(pulsarProperties.getTopic() + "-dlq").build()) .autoUpdatePartitions(true).receiverQueueSize(2000) .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest) .messageListener(consumer).subscribe();What did you expect to see?
The consumer should consume a message only once & that is happening as expected most of the time.
But occasionally, The consumer is consuming the same message twice which is causing consistency issues with the application logic.
What did you see instead?
The consumer is consuming the same message twice which is causing consistency issues with the application logic.
I confirmed the same by logging the message ID in the consumed message.
2023-08-14 02:32:15.221 INFO [1a512eb2-2c23-4b91-bd2e-cc656df3a9c8] [] [pulsar-external-listener-12-1] [RecurringScheduledEventHandler.java:38] c.f.s.s.p.RecurringScheduledEventHandler - >> handling mesage ID 100260:12688:0 - pulsar-105-232023-08-14 02:32:15.225 INFO [720cf56f-9b4c-49f7-8f91-81c0fa9bba35] [] [pulsar-external-listener-12-1] [RecurringScheduledEventHandler.java:38] c.f.s.s.p.RecurringScheduledEventHandler - >> handling mesage ID 100260:12688:0 - pulsar-105-23Here, The same message ID
100260:12688:0is consumed by the same consumer threadpulsar-external-listener-12-1within few ms by1a512eb2-2c23-4b91-bd2e-cc656df3a9c8&720cf56f-9b4c-49f7-8f91-81c0fa9bba35How come the listener
pulsar-external-listener-12-1processes the same messages twice at the same time? The ack is yet to happen for the thread 1a512eb2-2c23-4b91-bd2e-cc656df3a9c8 but before that the same message is consumer & processed by the thread 720cf56f-9b4c-49f7-8f91-81c0fa9bba35Anything else?
No response
Are you willing to submit a PR?