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

Topic Configuration #19

Merged
merged 6 commits into from
Aug 15, 2019
Merged

Topic Configuration #19

merged 6 commits into from
Aug 15, 2019

Conversation

OneCricketeer
Copy link
Contributor

@OneCricketeer OneCricketeer commented Jun 17, 2019

  • Parse YAML to NewTopic Kafka object
  • Make topic factory discoverable(?)
  • Pass variables between AdminClientFactory and Topic factory to create topics
  • Integration Test to create topics

@OneCricketeer OneCricketeer changed the title [WIP] Add TopicFactory and lifecycle listener [WIP] Add Topic Configuration Jun 17, 2019
Copy link
Member

@natalie-zamani natalie-zamani left a comment

Choose a reason for hiding this comment

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

Some preliminary feedback. Thanks for starting on this!

@natalie-zamani natalie-zamani added the enhancement New feature or request label Jun 19, 2019
@natalie-zamani
Copy link
Member

@Cricket007 any update on this?

@OneCricketeer
Copy link
Contributor Author

Sorry, was on vacation. Addressed the review feedback. Not sure how to get the YAMLConfigurationFactory to test a list of topics, but I can do without that.

Regarding the actual creation of topics, I can't seem to get DropwizardKafkaIT to run with mvn integration-test

@OneCricketeer
Copy link
Contributor Author

OneCricketeer commented Aug 2, 2019

Regarding the stacktrace you showed, that's actually a different error than I have, but searching that suggests that since the spring-kafka Kafka dependency version is lower than the other that is actually included, there would be conflicts. To resolve that, I've moved kafka declaration into dependencyManagement to enforce the newer version, and now I seem to be able to get past that.

mvn -Prelease integration-test now runs as expected, though, not sure how to startup() the Managed AdminClient object from the tests such that the topics actually get created.

Also, you may want TravisCI to run mvn verify now to get the integration tests to actually get checked

// do nothing
if (this.topics != null && !this.topics.isEmpty()) {
// TODO: Check if topics already exist
this.adminClient.createTopics(this.topics);
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, what is the behavior of the client if createTopics is created every time the app starts up? Will it be a no-op if the topics already exist? Otherwise, the check might be pretty important.

Copy link
Member

@natalie-zamani natalie-zamani left a comment

Choose a reason for hiding this comment

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

@Cricket007 Should the AdminClientFactory have the Jackson polymorphic deserialization type stuff set up? That way, a user could come along and add a new type of AdminClientFactory other than the basic one more simply.

@natalie-zamani
Copy link
Member

@Cricket007 hey, let me know if you’re going to circle back to this today or tomorrow. If not I’ll cut a release for some other stuff, and release this when you have time to circle back.

@OneCricketeer
Copy link
Contributor Author

OneCricketeer commented Aug 12, 2019

Should the AdminClientFactory have the Jackson polymorphic deserialization type stuff set up?

Seems to be out of scope of this feature, no? Besides, not sure what that would look like.

In any case, I addressed all the other comments and wrote the simplest thing I could find for "check if topics exist" - https://stackoverflow.com/a/53442463/2308683

@natalie-zamani
Copy link
Member

@Cricket007 You could argue it’s out of scope for this PR, but it’s absolutely something that we need to support. Either you or I can add that in a separate PR.

this.topics.removeIf(newTopic -> {
boolean match = newTopic.name().equals(t);
if (match) {
log.warn("Not attempting to re-create existing topic {}.", newTopic.name());
Copy link
Member

@natalie-zamani natalie-zamani Aug 14, 2019

Choose a reason for hiding this comment

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

I think maybe a debug log (or a single info log with all of the skipped topics appended together) would be more appropriate. Otherwise, every time someone restarts their app, they may be flooded with warn logs.

Copy link
Member

@natalie-zamani natalie-zamani left a comment

Choose a reason for hiding this comment

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

Thanks again @Cricket007. I’ll add in the polymorphic deserialization bits and cut a release today or tomorrow.

@natalie-zamani natalie-zamani merged commit 66932b1 into dropwizard:master Aug 15, 2019
@OneCricketeer OneCricketeer deleted the feature/topic-configuration branch September 17, 2019 19:47
@OneCricketeer OneCricketeer changed the title [WIP] Add Topic Configuration Topic Configuration Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants