Class DeadLetterPolicy

java.lang.Object
org.apache.pulsar.client.api.v5.config.DeadLetterPolicy

public final class DeadLetterPolicy extends Object
Configuration for the dead letter queue mechanism.

When a message has been redelivered more than maxRedeliverCount times, it is moved to the dead letter topic instead of being redelivered again.

Construct via builder().

  • Method Details

    • maxRedeliverCount

      public int maxRedeliverCount()
      Returns:
      the maximum number of redelivery attempts before sending to the dead letter topic
    • retryLetterTopic

      public String retryLetterTopic()
      Returns:
      the custom retry letter topic, or null for the auto-generated default
    • deadLetterTopic

      public String deadLetterTopic()
      Returns:
      the custom dead letter topic, or null for the auto-generated default
    • initialSubscriptionName

      public String initialSubscriptionName()
      Returns:
      the subscription name to create on the dead letter topic, or null if none
    • builder

      public static DeadLetterPolicy.Builder builder()
      Returns:
      a new builder for constructing a DeadLetterPolicy