Class AzkarraApplication
- java.lang.Object
-
- io.streamthoughts.azkarra.streams.AzkarraApplication
-
public class AzkarraApplication extends Object
AzkarraApplication
is the high-level class which can be used to deploy a simple server for managing multipleKafkaStreams
instances.
-
-
Constructor Summary
Constructors Constructor Description AzkarraApplication(Class<?>... sources)
Creates a newAzkarraApplication
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AzkarraApplication
addConfiguration(Conf configuration)
Adds the specifiedConf
to the configuration of thisAzkarraApplication
.AzkarraApplication
addSource(Class<?> source)
Adds a class source which must be used for initializing thisAzkarraApplication
.AzkarraApplication
addSources(Class<?>... sources)
Adds a class sources which must be used for initializing thisAzkarraApplication
.AzkarraApplication
enableHttpServer(boolean enableHttpServer)
AzkarraApplication
enableHttpServer(boolean enableHttpServer, Conf conf)
AzkarraApplication
enableHttpServer(boolean enableHttpServer, HttpServerConf httpServerConf)
Conf
getConfiguration()
Gets the configuration for thisAzkarraApplication
.AzkarraContext
getContext()
Gets theAzkarraContext
.Class<?>
getMainApplicationClass()
static AzkarraContext
run()
static AzkarraContext
run(Class<?>[] sources, String[] args)
static AzkarraContext
run(Class<?> sources, String[] args)
AzkarraContext
run(String[] args)
Runs thisAzkarraApplication
.AzkarraApplication
setAutoStart(boolean enable)
Sets if all registered topologies must be automatically added to the default environment and started when thisAzkarraApplication
is started.AzkarraApplication
setAutoStart(boolean enable, String targetEnv)
Sets if all registered topologies must be automatically added to the specified environment and started when thisAzkarraApplication
is started.AzkarraApplication
setBanner(Banner banner)
Sets theBanner
to print when thisAzkarraContext
is started.AzkarraApplication
setBannerMode(Banner.Mode mode)
Sets the mode used to print theBanner
instance when thisAzkarraContext
is started.AzkarraApplication
setConfiguration(Conf configuration)
Sets theAzkarraApplication
configuration.AzkarraApplication
setContext(AzkarraContext context)
Sets theAzkarraContext
that must be used for thisAzkarraApplication
.AzkarraApplication
setEnableComponentScan(boolean enableComponentScan)
Sets if the classpath must be scanned for searching components.AzkarraApplication
setRegisterShutdownHook(boolean registerShutdownHook)
Sets if the createdAzkarraContext
should have a shutdown hook registered.
-
-
-
Constructor Detail
-
AzkarraApplication
public AzkarraApplication(Class<?>... sources)
Creates a newAzkarraApplication
instance.- Parameters:
sources
- the classes which are used for auto-configuring the application.
-
-
Method Detail
-
run
public static AzkarraContext run()
-
run
public static AzkarraContext run(Class<?> sources, String[] args)
-
run
public static AzkarraContext run(Class<?>[] sources, String[] args)
-
enableHttpServer
public AzkarraApplication enableHttpServer(boolean enableHttpServer)
-
enableHttpServer
public AzkarraApplication enableHttpServer(boolean enableHttpServer, HttpServerConf httpServerConf)
-
enableHttpServer
public AzkarraApplication enableHttpServer(boolean enableHttpServer, Conf conf)
-
setEnableComponentScan
public AzkarraApplication setEnableComponentScan(boolean enableComponentScan)
Sets if the classpath must be scanned for searching components.- Parameters:
enableComponentScan
- enable/disable component scan.- Returns:
- this
AzkarraApplication
instance.
-
setRegisterShutdownHook
public AzkarraApplication 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.
-
setBannerMode
public AzkarraApplication setBannerMode(Banner.Mode mode)
Sets the mode used to print theBanner
instance when thisAzkarraContext
is started.- Parameters:
mode
- theBanner.Mode
to use.- Returns:
- this
AzkarraApplication
instance.
-
setBanner
public AzkarraApplication setBanner(Banner banner)
Sets theBanner
to print when thisAzkarraContext
is started.- Parameters:
banner
- theBanner
instance to print.- Returns:
- this
AzkarraApplication
instance.
-
setAutoStart
public AzkarraApplication setAutoStart(boolean enable)
Sets if all registered topologies must be automatically added to the default environment and started when thisAzkarraApplication
is started. Note : This is important to not enable auto-start if some topologies are already registered to environments either programmatically or through configuration, otherwise topologies can start twice.- Parameters:
enable
- if the topologies should be started.- Returns:
- this
AzkarraApplication
instance.
-
setAutoStart
public AzkarraApplication setAutoStart(boolean enable, String targetEnv)
Sets if all registered topologies must be automatically added to the specified environment and started when thisAzkarraApplication
is started. Note : This is important to not enable auto-start if some topologies are already registered to environments either programmatically or through configuration, otherwise topologies can start twice.- Parameters:
enable
- if the topologies should be started.targetEnv
- the target environment for all topologies.- Returns:
- this
AzkarraApplication
instance.
-
addConfiguration
public AzkarraApplication addConfiguration(Conf configuration)
Adds the specifiedConf
to the configuration of thisAzkarraApplication
.- Parameters:
configuration
- theConf
instance to be used.- Returns:
- this
AzkarraApplication
instance.
-
setConfiguration
public AzkarraApplication setConfiguration(Conf configuration)
Sets theAzkarraApplication
configuration.- Parameters:
configuration
- theConf
instance to be used.- Returns:
- this
AzkarraApplication
instance.
-
getConfiguration
public Conf getConfiguration()
Gets the configuration for thisAzkarraApplication
.- Returns:
- the
Conf
instance.
-
run
public AzkarraContext run(String[] args)
Runs thisAzkarraApplication
.
-
addSource
public AzkarraApplication addSource(Class<?> source)
Adds a class source which must be used for initializing thisAzkarraApplication
.- Parameters:
source
- the {@link class} to be add.- Returns:
- this
AzkarraApplication
instance.
-
addSources
public AzkarraApplication addSources(Class<?>... sources)
Adds a class sources which must be used for initializing thisAzkarraApplication
.- Parameters:
sources
- the list of {@link class} to be add.- Returns:
- this
AzkarraApplication
instance.
-
setContext
public AzkarraApplication setContext(AzkarraContext context)
Sets theAzkarraContext
that must be used for thisAzkarraApplication
.- Parameters:
context
- theAzkarraContext
to be used.- Returns:
- this
AzkarraApplication
instance.
-
getContext
public AzkarraContext getContext()
Gets theAzkarraContext
.- Returns:
- a
AzkarraContext
context, ornull
if not initialized.
-
getMainApplicationClass
public Class<?> getMainApplicationClass()
-
-