Skip to content

[Bug] Multiple duplicate RETRY Topics have been generated. #20427

@gaecfov

Description

@gaecfov

Search before asking

  • I searched in the issues and found nothing similar.

Version

Server Version:
2.10.2
3.0.0
Client Version:
Java 2.10.2
Java 3.0.0

Minimal reproduce step

  1. Create a topic: my_topic.
  2. Subscribe to 'my_topic' with regular expression 'my_.*', enable retry, and subscribe with the name 'my_sub'.
  3. When receiving messages, use 'consumer.reconsumeLaterAsync' to retry.
  4. Send some messages to 'my_topic'.
  5. View the generated RETRY topics.
  public static void main(String[] args) throws IOException {
    PulsarClient client = PulsarClient.builder().serviceUrl("pulsar://127.0.0.1:6650").build();

    Consumer<String> consumer = client.newConsumer(Schema.STRING)
        .subscriptionName("my_sub")
        .subscriptionType(SubscriptionType.Shared)
        .topicsPattern("persistent://public/default/my_.*")
        .enableRetry(true)
        .deadLetterPolicy(DeadLetterPolicy.builder()
            .maxRedeliverCount(3)
            .build())
        .messageListener((c, msg) -> {
          //trigger retry
          System.out.println("receive msg:" + msg);
          c.reconsumeLaterAsync(msg, 5, TimeUnit.SECONDS);
        })
        .subscribe();
    System.out.println("subscribed..." + consumer.getConsumerName());

    Producer<String> producer = client.newProducer(Schema.STRING).topic("persistent://public/default/my_topic").create();
    MessageId msgId = producer.newMessage(Schema.STRING).value("test message").send();
    System.out.println(msgId);

    System.in.read();
  }

subscribe topic with pattern:my_.*
send

What did you expect to see?

There is only one topic named 'my_topic-my_sub-RETRY'

What did you see instead?

Every time I restart the subscription, a new RETRY queue is generated, for example:
First time: 'my_topic-my_sub-RETRY',
Second time: 'my_topic-my_sub-RETRY-my_sub-RETRY',
Third time: 'my_topic-my_sub-RETRY-my_sub-RETRY-my_sub-RETRY'.

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThe PR fixed a bug or issue reported a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions