Package io.streamthoughts.azkarra.api
Interface StreamsExecutionEnvironment
-
- All Known Implementing Classes:
DefaultStreamsExecutionEnvironment
public interface StreamsExecutionEnvironment
A StreamsExecutionEnvironment manages the lifecycle ofTopology
instances.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ENABLE_WAIT_FOR_TOPICS_CONFIG
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description StreamsExecutionEnvironment
addFallbackConfiguration(Conf settings)
Adds streamsConfig that will be used in fallback if not present in defined environment streamsConfig.StreamsExecutionEnvironment
addGlobalStateListener(org.apache.kafka.streams.processor.StateRestoreListener listener)
Adds aStateRestoreListener
instance that will set to allKafkaStreams
instance created in thisStreamsExecutionEnvironment
.StreamsExecutionEnvironment
addStateListener(org.apache.kafka.streams.KafkaStreams.StateListener listener)
Adds aKafkaStreams.StateListener
instance that will set to allKafkaStreams
instance created in thisStreamsExecutionEnvironment
.ApplicationId
addTopology(Supplier<TopologyProvider> provider)
Add a newTopologyProvider
instance to thisStreamsExecutionEnvironment
to be started.ApplicationId
addTopology(Supplier<TopologyProvider> provider, Executed executed)
Add a newTopologyProvider
instance to thisStreamsExecutionEnvironment
to be started.Collection<KafkaStreamsContainer>
applications()
Returns allKafkaStreams
started applications.Conf
getConfiguration()
Gets this environment configuration.String
name()
Gets the name of thisStreamsExecutionEnvironment
.void
remove(ApplicationId id)
Stops the streams instance for the specified application id and remove the associated topology from this environment.StreamsExecutionEnvironment
setApplicationIdBuilder(Supplier<ApplicationIdBuilder> supplier)
Sets theApplicationIdBuilder
that should be used for building streamsapplication.id
.StreamsExecutionEnvironment
setConfiguration(Conf configuration)
Sets this environment configuration.StreamsExecutionEnvironment
setRocksDBConfig(RocksDBConfig settings)
Sets theRocksDBConfig
streamsConfig used by topology persistent stores.StreamsExecutionEnvironment
setWaitForTopicsToBeCreated(boolean waitForTopicToBeCreated)
Sets if the streams instances should wait for topics source to be created before starting.void
start()
Starts thisStreamsExecutionEnvironment
instance.State
state()
Gets the state f thisStreamsExecutionEnvironment
.default void
stop()
Stops thisStreamsExecutionEnvironment
instance and all runningKafkaStreams
instance.void
stop(boolean cleanUp)
Stops thisStreamsExecutionEnvironment
instance and all runningKafkaStreams
instance.void
stop(ApplicationId id, boolean cleanUp)
Stops the streams instance for the specified application id.
-
-
-
Field Detail
-
ENABLE_WAIT_FOR_TOPICS_CONFIG
static final String ENABLE_WAIT_FOR_TOPICS_CONFIG
- See Also:
- Constant Field Values
-
-
Method Detail
-
name
String name()
Gets the name of thisStreamsExecutionEnvironment
.- Returns:
- the string name.
-
state
State state()
Gets the state f thisStreamsExecutionEnvironment
.- Returns:
- the
State
.
-
addStateListener
StreamsExecutionEnvironment addStateListener(org.apache.kafka.streams.KafkaStreams.StateListener listener)
Adds aKafkaStreams.StateListener
instance that will set to allKafkaStreams
instance created in thisStreamsExecutionEnvironment
.- Parameters:
listener
- theKafkaStreams.StateListener
instance.- Returns:
- this
StreamsExecutionEnvironment
instance. - Throws:
IllegalStateException
- if thisStreamsExecutionEnvironment
instance is started.
-
addGlobalStateListener
StreamsExecutionEnvironment addGlobalStateListener(org.apache.kafka.streams.processor.StateRestoreListener listener)
Adds aStateRestoreListener
instance that will set to allKafkaStreams
instance created in thisStreamsExecutionEnvironment
.- Parameters:
listener
- theStateRestoreListener
instance.- Returns:
- this
StreamsExecutionEnvironment
instance. - Throws:
IllegalStateException
- if thisStreamsExecutionEnvironment
instance is started.- See Also:
.
-
applications
Collection<KafkaStreamsContainer> applications()
Returns allKafkaStreams
started applications.- Returns:
- a collection of
KafkaStreamsContainer
applications.
-
setConfiguration
StreamsExecutionEnvironment setConfiguration(Conf configuration)
Sets this environment configuration.- Returns:
- this
StreamsExecutionEnvironment
instance.
-
getConfiguration
Conf getConfiguration()
Gets this environment configuration.- Returns:
- the
Conf
instance.
-
setRocksDBConfig
StreamsExecutionEnvironment setRocksDBConfig(RocksDBConfig settings)
Sets theRocksDBConfig
streamsConfig used by topology persistent stores.- Parameters:
settings
- theRocksDBConfig
instance.- Returns:
- this
StreamsExecutionEnvironment
instance.
-
setApplicationIdBuilder
StreamsExecutionEnvironment setApplicationIdBuilder(Supplier<ApplicationIdBuilder> supplier)
Sets theApplicationIdBuilder
that should be used for building streamsapplication.id
.- Parameters:
supplier
- theApplicationIdBuilder
instance supplier.- Returns:
- this
StreamsExecutionEnvironment
instance.
-
setWaitForTopicsToBeCreated
StreamsExecutionEnvironment setWaitForTopicsToBeCreated(boolean waitForTopicToBeCreated)
Sets if the streams instances should wait for topics source to be created before starting. If some source topics are missing at startup, a streams instance fails.- Parameters:
waitForTopicToBeCreated
- should wait for topics to be created.- Returns:
- this
StreamsExecutionEnvironment
instance.
-
addFallbackConfiguration
StreamsExecutionEnvironment addFallbackConfiguration(Conf settings)
Adds streamsConfig that will be used in fallback if not present in defined environment streamsConfig.- Parameters:
settings
- theConf
instance.- Returns:
- this
StreamsExecutionEnvironment
instance.
-
addTopology
ApplicationId addTopology(Supplier<TopologyProvider> provider)
Add a newTopologyProvider
instance to thisStreamsExecutionEnvironment
to be started.- Parameters:
provider
- theTopologyProvider
supplier.- Returns:
- this
ApplicationId
instance if the environment is already started, otherwisenull
.
-
addTopology
ApplicationId addTopology(Supplier<TopologyProvider> provider, Executed executed)
Add a newTopologyProvider
instance to thisStreamsExecutionEnvironment
to be started.- Parameters:
provider
- theTopologyProvider
supplier.executed
- theExecuted
instance.- Returns:
- this
ApplicationId
instance if the environment is already started, otherwisenull
.
-
start
void start()
Starts thisStreamsExecutionEnvironment
instance.
-
stop
default void stop()
Stops thisStreamsExecutionEnvironment
instance and all runningKafkaStreams
instance.
-
stop
void stop(boolean cleanUp)
Stops thisStreamsExecutionEnvironment
instance and all runningKafkaStreams
instance.- Parameters:
cleanUp
- if local states of eachKafkaStreams
instance must be cleanup.- See Also:
.
-
stop
void stop(ApplicationId id, boolean cleanUp)
Stops the streams instance for the specified application id.- Parameters:
id
- theApplicationId
of the streams instance.cleanUp
- if local states of eachKafkaStreams
instance must be cleanup.- See Also:
.
-
remove
void remove(ApplicationId id)
Stops the streams instance for the specified application id and remove the associated topology from this environment.- Parameters:
id
- theApplicationId
of the streams instance.- See Also:
.
-
-