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
KafkaStreamsCustomizers.
| 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.
|
| 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() |
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 |
setInfrastructureCustomizer(KafkaStreamsInfrastructureCustomizer infrastructureCustomizer)
Set a customizer to configure the builder and/or topology before creating the stream.
|
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 |
setStreamsConfiguration(java.util.Properties streamsConfig)
Set the streams configuration
Properties 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).public StreamsBuilderFactoryBean(KafkaStreamsConfiguration streamsConfig, CleanupConfig cleanupConfig)
streamsConfig - the streams configuration.cleanupConfig - the cleanup configuration.public StreamsBuilderFactoryBean(KafkaStreamsConfiguration streamsConfig)
streamsConfig - the streams configuration.public void setStreamsConfiguration(java.util.Properties streamsConfig)
Properties on this factory.streamsConfig - the streams configuration.@Nullable public java.util.Properties getStreamsConfiguration()
public void setClientSupplier(org.apache.kafka.streams.KafkaClientSupplier clientSupplier)
public void setInfrastructureCustomizer(KafkaStreamsInfrastructureCustomizer infrastructureCustomizer)
infrastructureCustomizer - the customizerpublic 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.PhasedgetPhase in interface org.springframework.context.SmartLifecyclepublic 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.SmartLifecyclepublic void stop(java.lang.Runnable callback)
stop in interface org.springframework.context.SmartLifecyclepublic void start()
start in interface org.springframework.context.Lifecyclepublic void stop()
stop in interface org.springframework.context.Lifecyclepublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecycle