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.ApplicationId
addTopology(Class<? extends TopologyProvider> type, Executed executed)
Adds a topology to the default environment of this context.ApplicationId
addTopology(Class<? extends TopologyProvider> type, String environment, Executed executed)
Adds a topology to a specified environment.ApplicationId
addTopology(String type, Executed executed)
Adds a topology to the default environment of this context.ApplicationId
addTopology(String type, String environment, Executed executed)
Adds a topology to a specified environment.ApplicationId
addTopology(String type, String version, String environment, Executed executed)
Adds a topology to a specified environment.StreamsExecutionEnvironment
defaultExecutionEnvironment()
Gets the defaultStreamsExecutionEnvironment
.List<StreamsExecutionEnvironment>
environments()
Gets allStreamsExecutionEnvironment
registered to this context.ComponentFactory
getComponentFactory()
Gets the internalComponentFactory
.Conf
getConfiguration()
Returns the global context streamsConfig of thisAzkarraContext
instance.StreamsExecutionEnvironment
getEnvironmentForNameOrCreate(String envName)
Gets theStreamsExecutionEnvironment
for the specified name or create a new one.TopologyDescriptor
getTopology(String type)
Gets the topology for the specified class name or alias.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.Set<TopologyDescriptor>
topologyProviders()
Gets all topologies registered into thisAzkarraContext
even those ones which are not enable.Set<TopologyDescriptor>
topologyProviders(StreamsExecutionEnvironment env)
Gets all topologies registered into thisAzkarraContext
which are available for the given environment.-
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
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
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
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
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
ApplicationId
instance if the environment is already started, otherwisenull
.
-
addTopology
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
ApplicationId
instance if the environment is already started, otherwisenull
.
-
topologyProviders
Set<TopologyDescriptor> topologyProviders()
Gets all topologies registered into thisAzkarraContext
even those ones which are not enable.- Returns:
- a set of
TopologyDescriptor
.
-
topologyProviders
Set<TopologyDescriptor> topologyProviders(StreamsExecutionEnvironment env)
Gets all topologies registered into thisAzkarraContext
which are available for the given environment.- Parameters:
env
- theStreamsExecutionEnvironment
- Returns:
- a set of
TopologyDescriptor
.
-
environments
List<StreamsExecutionEnvironment> environments()
Gets allStreamsExecutionEnvironment
registered to this context.- Returns:
- a list of
StreamsExecutionEnvironment
instance.
-
getEnvironmentForNameOrCreate
StreamsExecutionEnvironment getEnvironmentForNameOrCreate(String envName)
Gets theStreamsExecutionEnvironment
for the specified name or create a new one.- Parameters:
envName
- the environment name.- Returns:
- a
StreamsExecutionEnvironment
instance with the specified name.
-
defaultExecutionEnvironment
StreamsExecutionEnvironment defaultExecutionEnvironment()
Gets the defaultStreamsExecutionEnvironment
.- Returns:
- a
StreamsExecutionEnvironment
instance.
-
getTopology
TopologyDescriptor getTopology(String type)
Gets the topology for the specified class name or alias.- Parameters:
type
- the topology type.- Returns:
- the
TopologyDescriptor
.
-
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.
-
-