Skip to content

Expose Redelivery Count By Message Properties(issue-3030) - #3033

Merged
merlimat merged 5 commits into
apache:masterfrom
codelipenghui:issue-3030
Nov 25, 2018
Merged

merlimat merged 5 commits into
apache:masterfrom
codelipenghui:issue-3030

Conversation

@codelipenghui

Copy link
Copy Markdown
Contributor

Motivation

Use redelivery count as a solution for delayed message delivery feature.

For example, set ackTimeout 30 seconds in consumer, if consumer want to apply this message 60 seconds later, user can do ack when message redelivery count > 1.

Implement

Set redelivery count to message properties(a system property) when message received in consumer.

Fix issue #3030

@codelipenghui

Copy link
Copy Markdown
Contributor Author

Fix issue #2375

@merlimat

Copy link
Copy Markdown
Contributor

@codelipenghui The properties were meant to be completely application defined. That also might confuse some application that has its own set of keys to suddenly see a new key there.

In general, I'd prefer to have a Message.getRedeliveryCount() method instead, to have a clear separation from users vs system info. Additionally, this also improve discoverability of the feature.

If we foresee to need add multiple of these method, a context object would also be an option, though it would be probably far-fetched at this point.

@codelipenghui

Copy link
Copy Markdown
Contributor Author

@merlimat I'm already address your suggestion, thanks a lot.


private String topic; // only set for incoming messages
transient private Map<String, String> properties;
private int redeliveryCount;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, redeliveryCount is immutable.

@jiazhai

jiazhai commented Nov 25, 2018

Copy link
Copy Markdown
Member

run integration tests

@jiazhai

jiazhai commented Nov 25, 2018

Copy link
Copy Markdown
Member

Hi @merlimat,
@codelipenghui changed the code following your comments, Would you please help take a look again?

@merlimat merlimat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@merlimat
merlimat merged commit 9d2c001 into apache:master Nov 25, 2018
@codelipenghui
codelipenghui deleted the issue-3030 branch May 19, 2021 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants