Skip to content

Improve topic validation #351

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 2 commits into from
Feb 17, 2023

Conversation

onobc
Copy link
Collaborator

@onobc onobc commented Feb 16, 2023

  • Check if topic exists already for both partitioned and unpartitioned cases prior to creating.

Fixes #266

* Check if topic exists already for both
  partitioned and unpartitioned cases
  prior to creating.

Fixes spring-projects#266
if (topic.isPartitioned()) {
List<String> matchingPartitions = getMatchingTopicPartitions(topic, existingTopicsInNamespace);
if (existingTopicsInNamespace.contains(topicName)) {
Copy link
Collaborator Author

@onobc onobc Feb 16, 2023

Choose a reason for hiding this comment

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

@sobychacko sorry, I just realized that I muddied the code change commit w/ "use var everywhere" commit. I think the change is small enough to decipher though. 2 parts, w/ this being the 1st part of the actual change.

This is part one of the change: "If there is already a non-partitioned topic out there - barf"

}
}
}
else {
if (!existingTopicsInNamespace.contains(topic.getFullyQualifiedTopicName())) {
this.logger.debug(() -> "Topic " + topic.getFullyQualifiedTopicName() + " does not exist.");
var matchingPartitions = getMatchingTopicPartitions(topic, existingTopicsInNamespace);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is part two of the change: "If there is already a partitioned topic out there - barf"

@onobc onobc requested a review from sobychacko February 16, 2023 19:32
@@ -52,6 +52,7 @@
*/
@ExtendWith(SpringExtension.class)
@ContextConfiguration
@SuppressWarnings("JUnitMalformedDeclaration")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This prevents the warnings from IDEA on commit saying that test methods should declare method parameters (which IS valid w/ junit5).

@sobychacko sobychacko merged commit cbc7981 into spring-projects:main Feb 17, 2023
@onobc onobc deleted the cbono-topicadmin-improve branch March 5, 2023 17:30
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.

Partitioned Topics Work Once, Fail Subsequently
2 participants