public class PropertiesBuilder extends Object
PropertiesBuilder.BuildSteps
is a functional pattern for setting properties
Whenever a PropertiesBuilder.BuildSteps
is required, a user can provide a lambda function of this form for example:
builder -> builder
.withProperty("property1", value1)
.withProperty("property2", value2)
*
One of the key advantages of this pattern is it allows the framework flexibility how it treats these parameters, without complicating the user interaction.
For example, the framework may provide a default for "property1", which the user can override, and it may take the user's value for "property2" and apply some post processing to it.
Modifier and Type | Class and Description |
---|---|
static interface |
PropertiesBuilder.BuildSteps
A functional interface representing a configuration step that is applied to a properties builder
|
static class |
PropertiesBuilder.Target
Representing the Target application requiring the properties
|
Constructor and Description |
---|
PropertiesBuilder() |
Modifier and Type | Method and Description |
---|---|
PropertiesBuilder |
withBootstrapServers(String bootstrapServers) |
PropertiesBuilder |
withProperties(Map<String,Object> properties) |
PropertiesBuilder |
withProperties(Properties properties) |
PropertiesBuilder |
withProperty(String key,
Object value) |
PropertiesBuilder |
withStreamAppConfig(String appId,
String bootstrapServers)
Sets the essential properties for Kafka Streams applications (app id and bootstrap servers)
|
public PropertiesBuilder withProperty(String key, Object value)
public PropertiesBuilder withProperties(Properties properties)
public PropertiesBuilder withProperties(Map<String,Object> properties)
public PropertiesBuilder withBootstrapServers(String bootstrapServers)
public PropertiesBuilder withStreamAppConfig(String appId, String bootstrapServers)
appId
- the application id, used for consumer groups and internal topic prefixesbootstrapServers
- the bootstrap servers, used to connect to the Kafka clusterCopyright © 2019. All rights reserved.