Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dead-Letter Queues #189

Closed
sschepens opened this issue Feb 3, 2017 · 7 comments
Closed

Dead-Letter Queues #189

sschepens opened this issue Feb 3, 2017 · 7 comments
Labels
area/client type/feature The PR added a new feature or issue requested a new feature
Milestone

Comments

@sschepens
Copy link
Contributor

sschepens commented Feb 3, 2017

Pulsar should support dead-letter queues to prevent consumers being stuck when they cannot acknowledge a message.
Reference #180

@agarman
Copy link

agarman commented Feb 3, 2017

I am writing rejected messages to "TopicName{{RejectedMessage}}" then acknowledging the message. It'd be nice to have the broker handle this atomically.

An API like:

reject(msgId); // sends message into dead letter box for subscription; acknowledged in process
reroute(msgId, specificTopic); // same but into a specific topic

@merlimat
Copy link
Contributor

merlimat commented Feb 6, 2017

The primary concern I have with dead-letter queue is how to avoid that some misconfiguration can lead to send everything into that topic.

In some cases the application can have a pretty good idea that a message is bad/corrupted and thus triggering the rerouting of the message, but if for example a new field is introduced and the consumer is not updated, it might start sending everything to DLQ.

About doing the work in client vs server. I don't think there is a big functional difference. The 2 operations cannot be atomically executed anyway, we have to first publish and then skip the bad message.

My preference would go to doing that in client lib, to avoid scalability concern in broker.

Adding on what proposed by @agarman, what about configuring the DLQ on consumer config?

consumerConf.setDeadLetterQueue("persistent://.....");
consumerConf.sendToDeadLetterQueueAfterRetries(10);

Then in consumer code:

while (true) {
    Message msg = consumer.receive();
    try {
        // processMessage()
    } catch (Exception e) {
       consumer.reject(msg);
       continue;
    }

   consumer.acknowledge(msg);
}

The difficult part would be how to support transient vs persistent errors and rejections.

sijie pushed a commit to sijie/pulsar that referenced this issue Mar 4, 2018
@sijie
Copy link
Member

sijie commented Aug 15, 2018

PIP-22 is the proposal for implementing dead letter queue.

@sijie
Copy link
Member

sijie commented Aug 15, 2018

@codelipenghui @jiazhai : you guys can probably use this issue as the main issue for dead letter topic implementation.

@sijie sijie added area/client type/feature The PR added a new feature or issue requested a new feature labels Aug 15, 2018
@sijie sijie added this to the 2.2.0-incubating milestone Aug 20, 2018
@sijie
Copy link
Member

sijie commented Aug 20, 2018

#2400 is implementing dead letter topic.

@ivankelly
Copy link
Contributor

Closing as a dupe of #2400

sijie pushed a commit that referenced this issue Sep 14, 2018
### Motivation

Fixes #189

When consumer got messages from pulsar, It's difficult to ensure every message can be consume success. Pulsar support message redelivery feature by set acknowledge timeout when create a new consumer. This is a good feature guarantee consumer will not lost messages.

But however, some message will redelivery so many times possible, even to the extent that it can be never stop.

So, It's necessary to support a feature to control it by pulsar. Users can use this feature and customize this feature to control the message redelivery behavior. The feature named Dead Letter Topic.

### Modifications

Consumer can set maximum number of redeliveries by java client.
Consumer can set the name of Dead Letter Topic by java client, It’s not necessary.
Message exceeding the maximum number of redeliveries should send to Dead Letter Topic and acknowledged automatic.

### Result

If consumer enable future of dead letter topic. When Message exceeding the maximum number of redeliveries, message will send to the Dead Letter Topic and acknowledged automatic.
@fracasula
Copy link

Hey guys, are there any plans to add DLQ support in the Golang CGo based library? I see that it's supported in the pure Golang one which we are not using though due to your disclaimer saying that feature parity and stability has not been reached.

hangc0276 pushed a commit to hangc0276/pulsar that referenced this issue May 26, 2021
Bump version to 0.3.1-SNAPSHOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/client type/feature The PR added a new feature or issue requested a new feature
Projects
None yet
Development

No branches or pull requests

6 participants