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

GH-1828: Use consumer record's partition for @RetryableTopic #1829

Merged

Conversation

deepesh-verma
Copy link
Contributor

Resolves #1828

Update DeadLetterPublishingRecovererFactory#resolveDestination

  • Extract out a protected method to resolveTopicPartition for destination DLT
  • Set the partition to the same partition as the original record

Test Changes

  • Add tests for RetryableTopic with autoCreate=false
  • Remove unnecessary mockito stubbing from tests

…false

Signed-off-by: Deepesh <deepeshvrm1@gmail.com>
…esolveDestination

- Extract out a protected method to `resolveTopicPartition` for destination DLT
- Set the partition to the same partition as the original record
@deepesh-verma deepesh-verma marked this pull request as ready for review June 14, 2021 18:40
@tomazfernandes
Copy link
Contributor

Looks good to me, thanks!

Copy link
Contributor

@garyrussell garyrussell left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

Although this is technically a breaking change (a user might have configured retry topics with only one partition) we are saved by the DLPR falling back to null for an invalid partition. (S)he'll get a bunch of warning logs, but I think the chances are small.

: resolveTopicPartition(cr, nextDestination);
}

protected TopicPartition resolveTopicPartition(final ConsumerRecord<?, ?> cr, final DestinationTopic nextDestination) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs javadoc since it's a public API.

It should explain the default resolution algorithm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added javadoc. Thanks!

@garyrussell garyrussell merged commit cf954d7 into spring-projects:main Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Message always sent to 0th partition, if @RetryableTopic has autoCreateTopics="false" and no partition info
3 participants