public class StreamsBuilderFactoryBean
extends org.springframework.beans.factory.config.AbstractFactoryBean<org.apache.kafka.streams.StreamsBuilder>
implements org.springframework.context.SmartLifecycle
AbstractFactoryBean
for the StreamsBuilder
instance
and lifecycle control for the internal KafkaStreams
instance.
A fine grained control on KafkaStreams
can be achieved by
KafkaStreamsCustomizer
s.
Modifier and Type | Field and Description |
---|---|
static java.time.Duration |
DEFAULT_CLOSE_TIMEOUT
The default
Duration of 10 seconds for close timeout. |
Constructor and Description |
---|
StreamsBuilderFactoryBean()
Default constructor that creates the factory without configuration
Properties . |
StreamsBuilderFactoryBean(KafkaStreamsConfiguration streamsConfig)
Construct an instance with the supplied streams configuration.
|
StreamsBuilderFactoryBean(KafkaStreamsConfiguration streamsConfig,
CleanupConfig cleanupConfig)
Construct an instance with the supplied streams configuration and
clean up configuration.
|
StreamsBuilderFactoryBean(java.util.Map<java.lang.String,java.lang.Object> streamsConfig)
Deprecated.
in favor of
StreamsBuilderFactoryBean(KafkaStreamsConfiguration) . |
StreamsBuilderFactoryBean(java.util.Map<java.lang.String,java.lang.Object> streamsConfig,
CleanupConfig cleanupConfig)
Deprecated.
|
StreamsBuilderFactoryBean(org.apache.kafka.streams.StreamsConfig streamsConfig)
Deprecated.
|
StreamsBuilderFactoryBean(org.apache.kafka.streams.StreamsConfig streamsConfig,
CleanupConfig cleanupConfig)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.kafka.streams.StreamsBuilder |
createInstance() |
org.apache.kafka.streams.KafkaStreams |
getKafkaStreams()
Get a managed by this
StreamsBuilderFactoryBean KafkaStreams instance. |
java.lang.Class<?> |
getObjectType() |
int |
getPhase() |
org.apache.kafka.streams.StreamsConfig |
getStreamsConfig()
Deprecated.
in favor of
getStreamsConfiguration() . |
java.util.Properties |
getStreamsConfiguration() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
void |
setAutoStartup(boolean autoStartup) |
void |
setClientSupplier(org.apache.kafka.streams.KafkaClientSupplier clientSupplier) |
void |
setCloseTimeout(int closeTimeout)
Specify the timeout in seconds for the
KafkaStreams.close(Duration) operation. |
void |
setKafkaStreamsCustomizer(KafkaStreamsCustomizer kafkaStreamsCustomizer)
|
void |
setPhase(int phase) |
void |
setStateListener(org.apache.kafka.streams.KafkaStreams.StateListener stateListener) |
void |
setStateRestoreListener(org.apache.kafka.streams.processor.StateRestoreListener stateRestoreListener) |
void |
setStreamsConfig(org.apache.kafka.streams.StreamsConfig streamsConfig)
Deprecated.
in favor of
setStreamsConfiguration(Properties) . |
void |
setStreamsConfiguration(java.util.Properties streamsConfig)
Set
StreamsConfig on this factory. |
void |
setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler exceptionHandler) |
void |
start() |
void |
stop() |
void |
stop(java.lang.Runnable callback) |
public static final java.time.Duration DEFAULT_CLOSE_TIMEOUT
Duration
of 10 seconds
for close timeout.KafkaStreams.close(Duration)
public StreamsBuilderFactoryBean()
Properties
. It is the factory user's responsibility to properly set
Properties
using
setStreamsConfiguration(Properties)
.@Deprecated public StreamsBuilderFactoryBean(org.apache.kafka.streams.StreamsConfig streamsConfig)
StreamsBuilderFactoryBean(KafkaStreamsConfiguration)
streamsConfig
- the streams configuration.@Deprecated public StreamsBuilderFactoryBean(org.apache.kafka.streams.StreamsConfig streamsConfig, CleanupConfig cleanupConfig)
StreamsBuilderFactoryBean(KafkaStreamsConfiguration, CleanupConfig)
streamsConfig
- the streams configuration.cleanupConfig
- the cleanup configuration.public StreamsBuilderFactoryBean(KafkaStreamsConfiguration streamsConfig, CleanupConfig cleanupConfig)
streamsConfig
- the streams configuration.cleanupConfig
- the cleanup configuration.@Deprecated public StreamsBuilderFactoryBean(java.util.Map<java.lang.String,java.lang.Object> streamsConfig)
StreamsBuilderFactoryBean(KafkaStreamsConfiguration)
.streamsConfig
- the streams configuration.public StreamsBuilderFactoryBean(KafkaStreamsConfiguration streamsConfig)
streamsConfig
- the streams configuration.@Deprecated public StreamsBuilderFactoryBean(java.util.Map<java.lang.String,java.lang.Object> streamsConfig, CleanupConfig cleanupConfig)
StreamsBuilderFactoryBean(KafkaStreamsConfiguration, CleanupConfig)
.streamsConfig
- the streams configuration.cleanupConfig
- the cleanup configuration.@Deprecated public void setStreamsConfig(org.apache.kafka.streams.StreamsConfig streamsConfig)
setStreamsConfiguration(Properties)
.StreamsConfig
on this factory.streamsConfig
- the streams configuration.@Deprecated public org.apache.kafka.streams.StreamsConfig getStreamsConfig()
getStreamsConfiguration()
.public void setStreamsConfiguration(java.util.Properties streamsConfig)
StreamsConfig
on this factory.streamsConfig
- the streams configuration.@Nullable public java.util.Properties getStreamsConfiguration()
public void setClientSupplier(org.apache.kafka.streams.KafkaClientSupplier clientSupplier)
public void setKafkaStreamsCustomizer(KafkaStreamsCustomizer kafkaStreamsCustomizer)
kafkaStreamsCustomizer
- the KafkaStreamsCustomizer
to use.public void setStateListener(org.apache.kafka.streams.KafkaStreams.StateListener stateListener)
public void setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler exceptionHandler)
public void setStateRestoreListener(org.apache.kafka.streams.processor.StateRestoreListener stateRestoreListener)
public void setCloseTimeout(int closeTimeout)
KafkaStreams.close(Duration)
operation.
Defaults to DEFAULT_CLOSE_TIMEOUT
seconds.closeTimeout
- the timeout for close in seconds.KafkaStreams.close(Duration)
public java.lang.Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<org.apache.kafka.streams.StreamsBuilder>
getObjectType
in class org.springframework.beans.factory.config.AbstractFactoryBean<org.apache.kafka.streams.StreamsBuilder>
public void setAutoStartup(boolean autoStartup)
public void setPhase(int phase)
public int getPhase()
getPhase
in interface org.springframework.context.Phased
getPhase
in interface org.springframework.context.SmartLifecycle
public org.apache.kafka.streams.KafkaStreams getKafkaStreams()
StreamsBuilderFactoryBean
KafkaStreams
instance.StreamsBuilderFactoryBean
hasn't been started.protected org.apache.kafka.streams.StreamsBuilder createInstance()
createInstance
in class org.springframework.beans.factory.config.AbstractFactoryBean<org.apache.kafka.streams.StreamsBuilder>
public boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public void stop(java.lang.Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
public void start()
start
in interface org.springframework.context.Lifecycle
public void stop()
stop
in interface org.springframework.context.Lifecycle
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle