Package io.streamthoughts.azkarra.api
Interface AzkarraContext
-
- All Known Implementing Classes:
DefaultAzkarraContext
public interface AzkarraContext
The AzkarraContext.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> AzkarraContext
addComponent(ComponentFactory<T> factory)
Registers a components into this context.<T> AzkarraContext
addComponent(Class<T> cls)
Registers a components into this context.AzkarraContext
addComponent(String className)
Registers a components into this context.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.<T> Collection<T>
getAllComponentForType(Class<T> cls)
Get all component instances for the specified class.ComponentClassReader
getComponentClassReader()
Gets the internalComponentClassReader
.<T> T
getComponentForType(Class<T> cls)
Gets a component instance for the specified class.ComponentRegistry
getComponentRegistry()
Gets the internalComponentRegistry
.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
setComponentClassReader(ComponentClassReader reader)
Sets the internal theComponentClassReader
which is used for registering components to this context.AzkarraContext
setComponentRegistry(ComponentRegistry registry)
Sets the internal theComponentRegistry
which is used for registering components to this context.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.void
stop()
Stops thisAzkarraContext
instance.void
stop(boolean cleanUp)
Stops thisAzkarraContext
instance.Set<TopologyDescriptor>
topologyProviders()
Gets all topologies registered into thisAzkarraContext
.
-
-
-
Method Detail
-
setComponentRegistry
AzkarraContext setComponentRegistry(ComponentRegistry registry)
Sets the internal theComponentRegistry
which is used for registering components to this context.- Parameters:
registry
- theComponentRegistry
instance to be used.- Returns:
- this
AzkarraContext
instance.
-
getComponentRegistry
ComponentRegistry getComponentRegistry()
Gets the internalComponentRegistry
.- Returns:
- the
ComponentRegistry
instance to be used.
-
getComponentClassReader
ComponentClassReader getComponentClassReader()
Gets the internalComponentClassReader
.- Returns:
- the
ComponentClassReader
instance to be used.
-
setComponentClassReader
AzkarraContext setComponentClassReader(ComponentClassReader reader)
Sets the internal theComponentClassReader
which is used for registering components to this context.- Parameters:
reader
- theComponentClassReader
instance to be used.- Returns:
- this
AzkarraContext
instance.
-
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.- 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
. Note, if provider scan is enable then topologies will be scan when thisAzkarraContext
will be started.- 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.
-
addComponent
<T> AzkarraContext addComponent(Class<T> cls)
Registers a components into this context.- Parameters:
cls
- the component class.- Returns:
- this
AzkarraContext
instance.
-
addComponent
<T> AzkarraContext addComponent(ComponentFactory<T> factory)
Registers a components into this context.- Parameters:
factory
- theComponentFactory
instance.- Returns:
- this
AzkarraContext
instance.
-
addComponent
AzkarraContext addComponent(String className)
Registers a components into this context.- Parameters:
className
- the component class name.- Returns:
- this
AzkarraContext
instance.
-
getComponentForType
<T> T getComponentForType(Class<T> cls)
Gets a component instance for the specified class.- Type Parameters:
T
- the component type.- Parameters:
cls
- the component class.- Returns:
- the component instance of type
AzkarraContext
.
-
getAllComponentForType
<T> Collection<T> getAllComponentForType(Class<T> cls)
Get all component instances for the specified class.- Type Parameters:
T
- the component type.- Parameters:
cls
- the component class.- Returns:
- the component instance of type
AzkarraContext
.
-
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
void stop()
Stops thisAzkarraContext
instance.
-
-