Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
theodolite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sören Henning
theodolite
Commits
dd22b618
Commit
dd22b618
authored
May 14, 2020
by
Björn Vonheiden
Browse files
Options
Downloads
Patches
Plain Diff
Add a buildProperty function to KafkaStreamsBuilder in commons
This allows the usecases to create its own Properties object if needed.
parent
ce6dc165
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
application-kafkastreams-commons/src/main/java/spesb/commons/kafkastreams/KafkaStreamsBuilder.java
+16
-10
16 additions, 10 deletions
.../java/spesb/commons/kafkastreams/KafkaStreamsBuilder.java
with
16 additions
and
10 deletions
application-kafkastreams-commons/src/main/java/spesb/commons/kafkastreams/KafkaStreamsBuilder.java
+
16
−
10
View file @
dd22b618
...
@@ -112,25 +112,31 @@ public abstract class KafkaStreamsBuilder {
...
@@ -112,25 +112,31 @@ public abstract class KafkaStreamsBuilder {
protected
abstract
Topology
buildTopology
();
protected
abstract
Topology
buildTopology
();
/**
/**
* Builds the {@link KafkaStreams} instance.
* Build the {@link Properties} for a {@code KafkaStreams} application.
*
* @return A {@code Properties} object.
*/
*/
public
KafkaStreams
build
()
{
protected
Properties
buildProperties
()
{
// Check for required attributes for building properties.
return
PropertiesBuilder
Objects
.
requireNonNull
(
this
.
bootstrapServers
,
"Bootstrap server has not been set."
);
Objects
.
requireNonNull
(
this
.
applicationName
,
"Application name has not been set."
);
Objects
.
requireNonNull
(
this
.
applicationVersion
,
"Application version has not been set."
);
// Build properties.
final
Properties
properties
=
PropertiesBuilder
.
bootstrapServers
(
this
.
bootstrapServers
)
.
bootstrapServers
(
this
.
bootstrapServers
)
.
applicationId
(
this
.
applicationName
+
'-'
+
this
.
applicationVersion
)
.
applicationId
(
this
.
applicationName
+
'-'
+
this
.
applicationVersion
)
.
set
(
StreamsConfig
.
NUM_STREAM_THREADS_CONFIG
,
this
.
numThreads
,
p
->
p
>
0
)
.
set
(
StreamsConfig
.
NUM_STREAM_THREADS_CONFIG
,
this
.
numThreads
,
p
->
p
>
0
)
.
set
(
StreamsConfig
.
COMMIT_INTERVAL_MS_CONFIG
,
this
.
commitIntervalMs
,
p
->
p
>=
0
)
.
set
(
StreamsConfig
.
COMMIT_INTERVAL_MS_CONFIG
,
this
.
commitIntervalMs
,
p
->
p
>=
0
)
.
set
(
StreamsConfig
.
CACHE_MAX_BYTES_BUFFERING_CONFIG
,
this
.
cacheMaxBytesBuff
,
p
->
p
>=
0
)
.
set
(
StreamsConfig
.
CACHE_MAX_BYTES_BUFFERING_CONFIG
,
this
.
cacheMaxBytesBuff
,
p
->
p
>=
0
)
.
build
();
.
build
();
}
/**
* Builds the {@link KafkaStreams} instance.
*/
public
KafkaStreams
build
()
{
// Check for required attributes for building properties.
Objects
.
requireNonNull
(
this
.
bootstrapServers
,
"Bootstrap server has not been set."
);
Objects
.
requireNonNull
(
this
.
applicationName
,
"Application name has not been set."
);
Objects
.
requireNonNull
(
this
.
applicationVersion
,
"Application version has not been set."
);
// Create the Kafka streams instance.
// Create the Kafka streams instance.
return
new
KafkaStreams
(
this
.
buildTopology
(),
p
roperties
);
return
new
KafkaStreams
(
this
.
buildTopology
(),
this
.
buildP
roperties
()
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment