Skip to content

Remove default 30s ackTimeout when using deadLetterPolicy #19134

@klevy-toast

Description

@klevy-toast

Search before asking

Motivation

Context and additional context

The deadLetterPolicy was implemented before negativeAcknowledgement was an option, which meant that the client had to rely on ackTimeout to result in redelivery / DLQ. However, now that negativeAck is available, we should not default to using the 30s ackTimeout, since it can cause cascading redeliveries when an application takes longer than 30s to process a message. Additionally, the behavior is inconsistent by ordering in the ConsumerBuilder:

consumerBuilder
    .ackTimeout(0, TimeUnit.MILLISECONDS)
    .deadLetterPolicy(DeadLetterPolicy.builder().build())
    .subscribe()

vs

consumerBuilder
    .deadLetterPolicy(DeadLetterPolicy.builder().build())
    .ackTimeout(0, TimeUnit.MILLISECONDS)
    .subscribe()

Option 1 results in ackTimeout of 30s, despite disabling it explicitly, while option 2 does disable ackTimeout.

Solution

I would like to remove the default ackTimeout set here. This was discussed already here

Alternatives

If changing the default is not a viable solution, then we could add a flag in the ConsumerBuilder that denotes when ackTimeout has been set by the user and prevent the default from taking effect in this case, which was discussed already here

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/enhancementThe enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions