Skip to content

GH-2357: Switch to CompletableFuture #2360

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

Merged
merged 3 commits into from
Jul 21, 2022

Conversation

garyrussell
Copy link
Contributor

Resolves #2357

Spring Framework is planning to deprecate ListenableFuture in 6.0.

Add methods to the KafkaOperations (KafkaTemplate) that return
CompletableFuture instead; the ListenableFuture methods have now
been removed in 3.0.

Resolves spring-projects#2357

Spring Framework is planning to deprecate `ListenableFuture` in 6.0.

Add methods to the `KafkaOperations` (`KafkaTemplate`) that return
`CompletableFuture` instead; the `ListenableFuture` methods have now
been removed in 3.0.
* @deprecated no longer needed; use {@code KafkaOperations}.
*/
@Deprecated
public interface KafkaOperations2<K, V> {
Copy link
Member

Choose a reason for hiding this comment

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

Why cannot we remove it altogether?
I believe there is going to a migration from 2.8.x to 3.0.0 mostly through Spring Boot, so that replacement in the API of the KafkaOperations is going to be a breaking change anyway.
Therefore this one is just an extra burden for us to bear for the next version.

What do I miss?

Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking of people that had taken advantage of the migration path provided by 2.9.x...

KafkaOperations2<Integer, String> templateTx = new KafkaTemplate<>(pfTx).usingCompletableFuture();

This code would still work with 3.0 (with a deprecation warning only).

But, I suppose with a major release, this breaking change might be acceptable.

WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that's my idea as well: bite the bullet and remove.
One more breaking change won't hurt as it is already with those replaced return types.

@artembilan artembilan merged commit ed6673e into spring-projects:main Jul 21, 2022
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.

Change APIs to use CompletableFuture Instead of ListenableFuture
2 participants