Package io.streamthoughts.azkarra.api
Interface StreamsExecutionEnvironment<T extends StreamsExecutionEnvironment<T>>
-
- All Superinterfaces:
HasName
- All Known Implementing Classes:
LocalStreamsExecutionEnvironment
public interface StreamsExecutionEnvironment<T extends StreamsExecutionEnvironment<T>> extends HasName
AStreamsExecutionEnvironment
manages the execution and the lifecycle of one or manyKafkaStreams
instances that run either locally or remotely.- See Also:
KafkaStreamsContainer
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
StreamsExecutionEnvironment.View
AEnvironment
is used to describe the current state of aStreamsExecutionEnvironment
instance.
-
Field Summary
Fields Modifier and Type Field Description static String
ENVIRONMENT_DEFAULT_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default T
addConfiguration(Conf configuration)
Adds a new configuration to this environment.T
addConfiguration(Supplier<Conf> configuration)
Adds a new configuration to this environment.T
addFallbackConfiguration(Conf settings)
Adds settings to this environment that will be used in fallback if not present in the defined environment configuration.default StreamsExecutionEnvironment.View
describe()
Gets a serializable view of thisStreamsExecutionEnvironment
instance.Optional<KafkaStreamsApplication>
getApplicationById(ApplicationId id)
Gets theKafkaStreamsApplication
for the specifiedapplication.id
Supplier<ApplicationIdBuilder>
getApplicationIdBuilder()
Gets theApplicationIdBuilder
.Set<ApplicationId>
getApplicationIds()
Returns all {ApplicationId
for active Kafka Streams applications.Conf
getConfiguration()
Gets this environment configuration.default KafkaStreamsContainer
getContainerById(ContainerId id)
Gets aKafkaStreamsContainer
for the specified id.Set<ContainerId>
getContainerIds()
Returns allContainerId
for active Kafka Streams applications.Collection<KafkaStreamsContainer>
getContainers()
Returns all containers for active Kafka Streams applications.boolean
isDefault()
Check whether thisStreamsExecutionEnvironment
is marked as default.T
isDefault(boolean isDefault)
Sets whether this execution environment should be the default.String
name()
Gets the name of thisStreamsExecutionEnvironment
.StreamsTopologyExecution
newTopologyExecution(StreamsTopologyMeta meta, Executed executed)
Creates a newStreamsTopologyExecution
to be applied on thisStreamsExecutionEnvironment
.T
setApplicationIdBuilder(Supplier<ApplicationIdBuilder> supplier)
Sets theApplicationIdBuilder
that should be used for building streamsapplication.id
.void
start()
Starts thisStreamsExecutionEnvironment
instance.State
state()
Gets the state of thisStreamsExecutionEnvironment
.default void
stop()
Stops thisStreamsExecutionEnvironment
instance and all runningKafkaStreams
instance.void
stop(boolean cleanUp)
Stops thisStreamsExecutionEnvironment
instance and all runningKafkaStreams
instance.default void
stop(ApplicationId id, boolean cleanUp)
Stops all the streams instances for the specified application id.void
stop(ApplicationId id, boolean cleanUp, Duration timeout)
Stops all the streams instance for the specified application id.default void
stop(ContainerId id, boolean cleanUp)
Stops the streams container for the specifiedapplication.id
.void
stop(ContainerId id, boolean cleanUp, Duration timeout)
Stops the streams container for the specifiedapplication.id
.default void
terminate(ApplicationId id)
Terminates all streams container for the specifiedapplication.id
and remove the associated topology from this environment.void
terminate(ApplicationId id, Duration timeout)
Terminates all streams container for the specifiedapplication.id
and remove the associated topology from this environment.default void
terminate(ContainerId id)
Terminates all streams container for the specifiedapplication.id
and remove the associated topology from this environment.void
terminate(ContainerId id, Duration timeout)
Terminates theKafkaStreams
instance for the specifiedcontainer.id
and remove the associated topology from this environment.String
type()
Gets the type of thisStreamsExecutionEnvironment
.
-
-
-
Field Detail
-
ENVIRONMENT_DEFAULT_NAME
static final String ENVIRONMENT_DEFAULT_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
type
String type()
Gets the type of thisStreamsExecutionEnvironment
.- Returns:
- the string type.
-
name
String name()
Gets the name of thisStreamsExecutionEnvironment
.
-
state
State state()
Gets the state of thisStreamsExecutionEnvironment
.- Returns:
- the
State
.
-
isDefault
boolean isDefault()
Check whether thisStreamsExecutionEnvironment
is marked as default.- Returns:
true
if thisStreamsExecutionEnvironment
is marked as default.
-
isDefault
T isDefault(boolean isDefault)
Sets whether this execution environment should be the default.- Parameters:
isDefault
-true
to set this environment as default.- Returns:
- this
StreamsExecutionEnvironment
instance.
-
newTopologyExecution
StreamsTopologyExecution newTopologyExecution(StreamsTopologyMeta meta, Executed executed)
Creates a newStreamsTopologyExecution
to be applied on thisStreamsExecutionEnvironment
.- Parameters:
meta
- theStreamsTopologyMeta
to executed.executed
- the execution options.- Returns:
- the new
StreamsTopologyExecution
instance.
-
getContainers
Collection<KafkaStreamsContainer> getContainers()
Returns all containers for active Kafka Streams applications.- Returns:
- a collection of
KafkaStreamsContainer
applications.
-
getContainerById
default KafkaStreamsContainer getContainerById(ContainerId id)
Gets aKafkaStreamsContainer
for the specified id.- Parameters:
id
- theContainerId
.- Returns:
- the
KafkaStreamsContainer
.
-
getContainerIds
Set<ContainerId> getContainerIds()
Returns allContainerId
for active Kafka Streams applications.- Returns:
- the set of
ContainerId
.
-
getApplicationIds
Set<ApplicationId> getApplicationIds()
Returns all {ApplicationId
for active Kafka Streams applications.- Returns:
- the set of
ApplicationId
.
-
getApplicationById
Optional<KafkaStreamsApplication> getApplicationById(ApplicationId id)
Gets theKafkaStreamsApplication
for the specifiedapplication.id
- Parameters:
id
- theapplication.id
.- Returns:
- the
KafkaStreamsApplication
instance.
-
addConfiguration
default T addConfiguration(Conf configuration)
Adds a new configuration to this environment. This method can be invoked multiple time. The supplied configuration will override all prior configurations.- Returns:
- this
StreamsExecutionEnvironment
instance. - See Also:
addConfiguration(Supplier)
-
addConfiguration
T addConfiguration(Supplier<Conf> configuration)
Adds a new configuration to this environment. This method can be invoked multiple time. The supplied configuration will override all prior configurations.- Returns:
- this
StreamsExecutionEnvironment
instance.
-
getConfiguration
Conf getConfiguration()
Gets this environment configuration.- Returns:
- the
Conf
instance.
-
setApplicationIdBuilder
T setApplicationIdBuilder(Supplier<ApplicationIdBuilder> supplier)
Sets theApplicationIdBuilder
that should be used for building streamsapplication.id
.- Parameters:
supplier
- theApplicationIdBuilder
instance supplier.- Returns:
- this
StreamsExecutionEnvironment
instance.
-
getApplicationIdBuilder
Supplier<ApplicationIdBuilder> getApplicationIdBuilder()
Gets theApplicationIdBuilder
.- Returns:
- this
ApplicationIdBuilder
instance ornull
.
-
addFallbackConfiguration
T addFallbackConfiguration(Conf settings)
Adds settings to this environment that will be used in fallback if not present in the defined environment configuration.- Parameters:
settings
- theConf
instance.- Returns:
- this
StreamsExecutionEnvironment
instance.
-
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.- Throws:
IllegalStateException
- if the environment is not started.- See Also:
.
-
stop
default void stop(ApplicationId id, boolean cleanUp)
Stops all the streams instances for the specified application id.- Parameters:
id
- theApplicationId
of the streams instance.cleanUp
- if local states of eachKafkaStreams
instance must be cleanup.- Throws:
IllegalStateException
- if the environment is not started.IllegalArgumentException
- if no streams instance exist for the givenid
.- See Also:
.
-
stop
void stop(ApplicationId id, boolean cleanUp, Duration timeout)
Stops all 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.timeout
- the duration to wait for the streams to shutdown.- Throws:
IllegalStateException
- if the environment is not started.IllegalArgumentException
- if no streams instance exist for the givenid
.- See Also:
.
-
stop
default void stop(ContainerId id, boolean cleanUp)
Stops the streams container for the specifiedapplication.id
.- Parameters:
id
- theApplicationId
of the streams instance.cleanUp
- if local states of eachKafkaStreams
instance must be cleanup.- Throws:
IllegalStateException
- if the environment is not started.IllegalArgumentException
- if no streams instance exist for the givenid
.- See Also:
.
-
stop
void stop(ContainerId id, boolean cleanUp, Duration timeout)
Stops the streams container for the specifiedapplication.id
.- Parameters:
id
- theApplicationId
of the streams instance.cleanUp
- if local states of eachKafkaStreams
instance must be cleanup.timeout
- the duration to wait for the streams to shutdown.- Throws:
IllegalStateException
- if the environment is not started.IllegalArgumentException
- if no streams instance exist for the givenid
.- See Also:
.
-
terminate
default void terminate(ContainerId id)
Terminates all streams container for the specifiedapplication.id
and remove the associated topology from this environment.A clean up of the local state directory is performed when the instance is terminated.
- Parameters:
id
- theContainerId
of the streams instance.- Throws:
IllegalStateException
- if the environment is not started.IllegalArgumentException
- if no streams instance exist for the givenid
.
-
terminate
void terminate(ContainerId id, Duration timeout)
Terminates theKafkaStreams
instance for the specifiedcontainer.id
and remove the associated topology from this environment.A clean up of the local state directory is performed when the instance is terminated.
- Parameters:
id
- theContainerId
of the streams instance.timeout
- the duration to wait for the streams to shutdown.- Throws:
IllegalStateException
- if the environment is not started.IllegalArgumentException
- if no streams instance exist for the givenid
.
-
terminate
default void terminate(ApplicationId id)
Terminates all streams container for the specifiedapplication.id
and remove the associated topology from this environment.A clean up of the local state directory of each container is performed when an application is terminated.
- Parameters:
id
- theApplicationId
of the streams instance.- Throws:
IllegalStateException
- if the environment is not started.IllegalArgumentException
- if no streams instance exist for the givenid
.
-
terminate
void terminate(ApplicationId id, Duration timeout)
Terminates all streams container for the specifiedapplication.id
and remove the associated topology from this environment.A clean up of the local state directory of each container is performed when an application is terminated.
- Parameters:
id
- theApplicationId
of the streams instance.timeout
- the duration to wait for the streams to shutdown.- Throws:
IllegalStateException
- if the environment is not started.IllegalArgumentException
- if no streams instance exist for the givenid
.
-
describe
default StreamsExecutionEnvironment.View describe()
Gets a serializable view of thisStreamsExecutionEnvironment
instance.- Returns:
- the
StreamsExecutionEnvironment.View
backed bythis
.
-
-