Package io.streamthoughts.azkarra.api
Interface AzkarraContext
-
- All Superinterfaces:
ComponentRegistry
,ConfigurableComponentFactory
- All Known Implementing Classes:
DefaultAzkarraContext
public interface AzkarraContext extends ConfigurableComponentFactory, ComponentRegistry
The AzkarraContext.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description AzkarraContext
addConfiguration(Conf configuration)
Adds the specifiedConf
to the configuration of thisAzkarraContext
.AzkarraContext
addExecutionEnvironment(StreamsExecutionEnvironment<?> environment)
Adds theStreamsExecutionEnvironment
to this context.AzkarraContext
addListener(AzkarraContextListener listener)
Registers a new listener instance to this context.Optional<ApplicationId>
addTopology(Class<? extends TopologyProvider> type, Executed executed)
Adds a topology to the default environment of this context.Optional<ApplicationId>
addTopology(Class<? extends TopologyProvider> type, String environment, Executed executed)
Adds a topology to a specified environment.Optional<ApplicationId>
addTopology(String type, Executed executed)
Adds a topology to the default environment of this context.Optional<ApplicationId>
addTopology(String type, String environment, Executed executed)
Adds a topology to a specified environment.Optional<ApplicationId>
addTopology(String type, String version, String environment, Executed executed)
Adds a topology to a specified environment.List<StreamsExecutionEnvironment<?>>
getAllEnvironments()
Gets allStreamsExecutionEnvironment
registered to this context.ComponentFactory
getComponentFactory()
Gets the internalComponentFactory
.Conf
getConfiguration()
Returns the global context streamsConfig of thisAzkarraContext
instance.StreamsExecutionEnvironment<?>
getDefaultEnvironment()
Gets the defaultStreamsExecutionEnvironment
.StreamsExecutionEnvironment<?>
getEnvironmentForName(String envName)
Gets theStreamsExecutionEnvironment
for the specified name.Set<TopologyDescriptor>
getTopologyDescriptors()
Gets all topologies registered into thisAzkarraContext
even those ones which are not enable.Set<TopologyDescriptor>
getTopologyDescriptors(StreamsExecutionEnvironment<?> env)
Gets all topologies registered into thisAzkarraContext
which are available for the given environment.Set<TopologyDescriptor>
getTopologyDescriptors(String environmentName)
Gets all topologies registered into thisAzkarraContext
which are available for the given environment.AzkarraContext
setConfiguration(Conf configuration)
Sets the default configuration to be used for thisAzkarraContext
.AzkarraContext
setRegisterShutdownHook(boolean registerShutdownHook)
Sets if the createdAzkarraContext
should have a shutdown hook registered.void
start()
Starts thisAzkarraContext
instance.default void
stop()
Stops thisAzkarraContext
instance.void
stop(boolean cleanUp)
Stops thisAzkarraContext
instance.-
Methods inherited from interface io.streamthoughts.azkarra.api.components.ComponentRegistry
registerComponent, registerComponent, registerComponent, registerComponent, registerSingleton, registerSingleton, registerSingleton, registerSingleton, registerSingleton
-
Methods inherited from interface io.streamthoughts.azkarra.api.components.ConfigurableComponentFactory
getAllComponents, getAllComponents, getAllComponents, getAllComponents, getComponent, getComponent, getComponent, getComponent
-
-
-
-
Method Detail
-
getComponentFactory
ComponentFactory getComponentFactory()
Gets the internalComponentFactory
.- Specified by:
getComponentFactory
in interfaceConfigurableComponentFactory
- Returns:
- the
ComponentFactory
instance to be used.
-
addListener
AzkarraContext addListener(AzkarraContextListener listener)
Registers a new listener instance to this context.- Parameters:
listener
- theAzkarraContextListener
instance to register.- Returns:
- this
AzkarraContext
instance.
-
setRegisterShutdownHook
AzkarraContext setRegisterShutdownHook(boolean registerShutdownHook)
Sets if the createdAzkarraContext
should have a shutdown hook registered. Defaults totrue
to ensure that JVM shutdowns are handled gracefully.- Parameters:
registerShutdownHook
- if the shutdown hook should be registered- Returns:
- this
AzkarraContext
instance.
-
getConfiguration
Conf getConfiguration()
Returns the global context streamsConfig of thisAzkarraContext
instance.- Specified by:
getConfiguration
in interfaceConfigurableComponentFactory
- Returns:
- a
Conf
instance.
-
setConfiguration
AzkarraContext setConfiguration(Conf configuration)
Sets the default configuration to be used for thisAzkarraContext
.- Parameters:
configuration
- theConf
instance.- Returns:
- this
AzkarraContext
instance.
-
addConfiguration
AzkarraContext addConfiguration(Conf configuration)
Adds the specifiedConf
to the configuration of thisAzkarraContext
.- Parameters:
configuration
- theConf
instance to be used.- Returns:
- this
AzkarraContext
instance.
-
addExecutionEnvironment
AzkarraContext addExecutionEnvironment(StreamsExecutionEnvironment<?> environment) throws AlreadyExistsException
Adds theStreamsExecutionEnvironment
to this context.- Parameters:
environment
- theStreamsExecutionEnvironment
instance.- Returns:
- this
AzkarraContext
instance. - Throws:
AlreadyExistsException
- if aStreamsExecutionEnvironment
is already registered for the given name.
-
addTopology
Optional<ApplicationId> addTopology(String type, Executed executed)
Adds a topology to the default environment of this context.- Parameters:
type
- the fully qualified class name or alias of the targetTopologyProvider
.executed
- theExecuted
instance.- Returns:
- the
ApplicationId
instance if the environment is already started, otherwisenull
.
-
addTopology
Optional<ApplicationId> addTopology(Class<? extends TopologyProvider> type, Executed executed)
Adds a topology to the default environment of this context.- Parameters:
type
- theTopologyProvider
class to add.executed
- theExecuted
instance.- Returns:
- the
ApplicationId
instance if the environment is already started, otherwisenull
.
-
addTopology
Optional<ApplicationId> addTopology(Class<? extends TopologyProvider> type, String environment, Executed executed)
Adds a topology to a specified environment.- Parameters:
type
- theTopologyProvider
class to add.environment
- the environment name.executed
- theExecuted
instance.- Returns:
- the
ApplicationId
instance if the environment is already started, otherwisenull
..
-
addTopology
Optional<ApplicationId> addTopology(String type, String environment, Executed executed)
Adds a topology to a specified environment.- Parameters:
type
- the fully qualified class name or alias of the targetTopologyProvider
.environment
- the environment name.executed
- theExecuted
instance.- Returns:
- the
ContainerId
instance if the environment is already started, otherwisenull
.
-
addTopology
Optional<ApplicationId> addTopology(String type, String version, String environment, Executed executed)
Adds a topology to a specified environment.- Parameters:
type
- the fully qualified class name or alias of the targetTopologyProvider
.version
- the topology version.environment
- the environment name.executed
- theExecuted
instance.- Returns:
- the
ContainerId
instance if the environment is already started, otherwisenull
.
-
getTopologyDescriptors
Set<TopologyDescriptor> getTopologyDescriptors()
Gets all topologies registered into thisAzkarraContext
even those ones which are not enable.- Returns:
- a set of
TopologyDescriptor
.
-
getTopologyDescriptors
Set<TopologyDescriptor> getTopologyDescriptors(String environmentName)
Gets all topologies registered into thisAzkarraContext
which are available for the given environment.- Parameters:
environmentName
- theStreamsExecutionEnvironment
- Returns:
- a set of
TopologyDescriptor
.
-
getTopologyDescriptors
Set<TopologyDescriptor> getTopologyDescriptors(StreamsExecutionEnvironment<?> env)
Gets all topologies registered into thisAzkarraContext
which are available for the given environment.- Parameters:
env
- theStreamsExecutionEnvironment
- Returns:
- a set of
TopologyDescriptor
.
-
getAllEnvironments
List<StreamsExecutionEnvironment<?>> getAllEnvironments()
Gets allStreamsExecutionEnvironment
registered to this context.- Returns:
- a list of
StreamsExecutionEnvironment
instance.
-
getEnvironmentForName
StreamsExecutionEnvironment<?> getEnvironmentForName(String envName)
Gets theStreamsExecutionEnvironment
for the specified name.- Parameters:
envName
- the environment name.- Returns:
- a
StreamsExecutionEnvironment
instance with the specified name.
-
getDefaultEnvironment
StreamsExecutionEnvironment<?> getDefaultEnvironment()
Gets the defaultStreamsExecutionEnvironment
. This method can returnnull
while the context is not started.- Returns:
- a
StreamsExecutionEnvironment
instance.
-
start
void start()
Starts thisAzkarraContext
instance.
-
stop
void stop(boolean cleanUp)
Stops thisAzkarraContext
instance.- Parameters:
cleanUp
- if local states of eachKafkaStreams
instance must be cleanup.- See Also:
.
-
stop
default void stop()
Stops thisAzkarraContext
instance.
-
-