Skip to content

KAFKA-5146 / move kafka-streams example to a new module #10131

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 1 commit into from
Apr 7, 2021

Conversation

MarcoLotz
Copy link
Contributor

Moved "streams-examples" to its own module outside kafka-streams module.
Because of org.apache.kafka.streams.processor.internals.StateDirectory in kafka-streams module, I had to add the jackson binder dependency. Before the change, It was probably being retrieved as a transitive dependency through "connect-json" dependency.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Copy link
Member

@ableegoldman ableegoldman left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the PR!

@mjsax
Copy link
Member

mjsax commented Mar 3, 2021

We have a larger PR in-progress that changes the gradle file significantly, and I expect conflicts (#10203). Wondering if we can just merge this PR or if it would be better to merge #10203 first and rebase this PR? \cc @ijuma

@mjsax mjsax added the streams label Mar 3, 2021
build.gradle Outdated
@@ -1528,8 +1523,7 @@ project(':streams') {
':streams:upgrade-system-tests-24:test',
':streams:upgrade-system-tests-25:test',
':streams:upgrade-system-tests-26:test',
':streams:upgrade-system-tests-27:test',
':streams:examples:test'
Copy link
Member

Choose a reason for hiding this comment

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

I think we should include the new streams-examples module in testAll goal.

@@ -0,0 +1 @@
/bin/
Copy link
Member

Choose a reason for hiding this comment

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

Just curious. Why do we need this?

compile(project(':connect:json')) {
// this transitive dependency is not used in Streams, and it breaks SBT builds
exclude module: 'javax.ws.rs-api'
}
Copy link
Member

Choose a reason for hiding this comment

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

This will break users who were relying on the transitive dependency. We may want to add a note to the release notes.

build.gradle Outdated
from(project(':streams:examples').jar) { into("libs/") }
from(project(':streams:examples').configurations.runtime) { into("libs/") }
from(project(':streams-examples').jar) { into("libs/") }
from(project(':streams-examples').configurations.runtime) { into("libs/") }
Copy link
Member

Choose a reason for hiding this comment

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

Why did we change the name?

Copy link
Member

Choose a reason for hiding this comment

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

We move the sub-module stream/examples into it's own module streams-examples. I would be weird to only name it examples as there is not parent streams reference any longer.

Copy link
Member

@ijuma ijuma Mar 3, 2021

Choose a reason for hiding this comment

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

Is there an advantage in having it as a top level module instead?

Copy link
Member

@mjsax mjsax Mar 3, 2021

Choose a reason for hiding this comment

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

As describe on the Jira, the goal is to get rid of the dependency of stream model on connect module. It's ok for streams-examples to depend on connect, but for streams is cleaner to not have it, and the dependency is only there to pull in stuff for the examples.

Copy link
Member

Choose a reason for hiding this comment

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

That seems independent of whether it's a submodule or not.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting. \cc @ableegoldman

I actually just tried to only remove the connect dependency from streams module (and add the Jackson dependency we need fo StateDirectory.java) and it seems to work.

So maybe we can just keep sub-module :streams:examples as-is?

Copy link
Member

Choose a reason for hiding this comment

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

Huh, maybe we're not even using connect in the examples to begin with (or at least, not anymore)? That actually doesn't sound too surprising, I've never seen Connect being used in any streams stuff I've looked at

That seems independent of whether it's a submodule or not

@ijuma WDYM? If the examples are a submodule of streams, and the examples depend on connect, then doesn't that mean the streams module will pull in connect? Even if we may turn out not to depend on connect to begin with...)

Copy link
Member

@ijuma ijuma Mar 4, 2021

Choose a reason for hiding this comment

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

@ableegoldman No. I removed the connect-json dependency from streams and left it in streams:examples and the dependency is gone from the streams module:

compileClasspath - Compile classpath for source set 'main'.
+--- project :clients
+--- org.slf4j:slf4j-api:1.7.30
+--- org.rocksdb:rocksdbjni:5.18.4
+--- com.fasterxml.jackson.core:jackson-annotations:2.10.5
--- com.fasterxml.jackson.core:jackson-databind:2.10.5.1
+--- com.fasterxml.jackson.core:jackson-annotations:2.10.5
--- com.fasterxml.jackson.core:jackson-core:2.10.5

Copy link
Member

Choose a reason for hiding this comment

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

I think that's all you need to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. I will send a PR later this week fixing it to be as discussed here then. Probably even tonight (CET).

@MarcoLotz MarcoLotz force-pushed the bugfix/KAFKA-5146 branch from cae4e15 to 75879da Compare March 6, 2021 10:04
// this transitive dependency is not used in Streams, and it breaks SBT builds
exclude module: 'javax.ws.rs-api'
}

implementation libs.slf4jApi
implementation libs.rocksDBJni
implementation libs.jacksonAnnotations
Copy link
Contributor Author

@MarcoLotz MarcoLotz Mar 6, 2021

Choose a reason for hiding this comment

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

"implementation libs.jacksonDatabind" is already being added to compileClassPath in streams module.
Thus it seems that indeed there's no need to add compile dependency of libs.jacksonDatabind to streams module. Please let me know if this is not the case.

Copy link
Member

Choose a reason for hiding this comment

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

SGTM.

Back in the days, KafkaStreams did not use anything JSON related, but in a later version we actually added this dependency.

build.gradle Outdated
@@ -1635,8 +1627,14 @@ project(':streams:examples') {
archivesBaseName = "kafka-streams-examples"

dependencies {
// this dependency should be removed after we unify data API
compile(project(':connect:json')) {
Copy link
Member

Choose a reason for hiding this comment

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

compile is deprecated, you have to choose between api and implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ijuma well noted! I have updated the PR. Since there are many "compile" references in build.gradle, I will have a look later on JIRA if there is already a ticket to update all this to api or implementation and raise if not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

having a better look, seems that no ticket is required. They are compileOnly or testCompileOnly which are not deprecated. All good.

@MarcoLotz
Copy link
Contributor Author

@mjsax @ijuma I have just updated the PR to fix merge-conflicts. Since the build file changes so often, would it be possible for you to have a quick look into it and verify if everything is as expected?

@mjsax
Copy link
Member

mjsax commented Mar 28, 2021

@MarcoLotz Overall LGTM -- but as mentioned by @ijuma (cf #10131 (comment)) we should add a comment to the upgrade note (ie, in docs/upgrade.html as well as docs/streams/upgrade-guide.html) -- there is already a corresponding section for the 3.0.0 release in both (just add one bullet point.)

@MarcoLotz
Copy link
Contributor Author

Thank you for pointing the directions @mjsax. Updated those files. Since it's not API related, I've used another paragraph on streams/upgrade-guide.html

@MarcoLotz MarcoLotz force-pushed the bugfix/KAFKA-5146 branch 2 times, most recently from 215b74a to bae4795 Compare April 6, 2021 14:41
Copy link
Member

@mjsax mjsax left a comment

Choose a reason for hiding this comment

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

Sorry the delay -- and thanks for updating the docs! Overall LGTM.

Seems there is some conflict -- can you rebase so we can merge this PR?

@MarcoLotz MarcoLotz force-pushed the bugfix/KAFKA-5146 branch from bae4795 to dd605f7 Compare April 6, 2021 16:54
@MarcoLotz
Copy link
Contributor Author

Sorry the delay -- and thanks for updating the docs! Overall LGTM.

Seems there is some conflict -- can you rebase so we can merge this PR?

Sure thing @mjsax ! Fixed merge conflicts and extra comment from @ijuma

@mjsax mjsax merged commit 33d0445 into apache:trunk Apr 7, 2021
@mjsax
Copy link
Member

mjsax commented Apr 7, 2021

Thanks for the PR @MarcoLotz

ijuma added a commit to ijuma/kafka that referenced this pull request Apr 7, 2021
* apache-github/trunk:
  KAFKA-10769 Remove JoinGroupRequest#containsValidPattern as it is dup… (apache#9851)
  KAFKA-12384: stabilize ListOffsetsRequestTest#testResponseIncludesLeaderEpoch (apache#10389)
  KAFKA-5146: remove Connect dependency from Streams module (apache#10131)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants