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.
-
-
Field Summary
Fields Modifier and Type Field Description static String
AZKARRA_ROOT_CONFIG_KEY
-
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
addConfigEntryLoader(ApplicationConfigEntryLoader configEntryLoader)
Adds a newApplicationConfigEntryLoader
to be used for reading the application configuration.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
.Conf
getConfiguration()
Gets the configuration for thisAzkarraApplication
.AzkarraContext
getContext()
Gets theAzkarraContext
.Class<?>
getMainApplicationClass()
Gets theClass
containing the main method.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
setHttpServerConf(Conf httpServerConf)
Sets the HTTP server configuration.AzkarraApplication
setHttpServerEnable(boolean httpServerEnable)
Sets whether the HTTP server should be enable.AzkarraApplication
setRegisterShutdownHook(boolean registerShutdownHook)
Sets if the createdAzkarraContext
should have a shutdown hook registered.static String
withAzkarraPrefix(String key)
Helper method to prefix a key property with the root property prefix (i.e"azkarra"
.
-
-
-
Field Detail
-
AZKARRA_ROOT_CONFIG_KEY
public static final String AZKARRA_ROOT_CONFIG_KEY
- See Also:
- Constant Field Values
-
-
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
-
withAzkarraPrefix
public static String withAzkarraPrefix(String key)
Helper method to prefix a key property with the root property prefix (i.e"azkarra"
.- Parameters:
key
- the key propery to prefix.- Returns:
- the prefixed key.
-
run
public static AzkarraContext run()
-
run
public static AzkarraContext run(Class<?> sources, String[] args)
-
run
public static AzkarraContext run(Class<?>[] sources, String[] args)
-
setHttpServerEnable
public AzkarraApplication setHttpServerEnable(boolean httpServerEnable)
Sets whether the HTTP server should be enable.- Parameters:
httpServerEnable
- set totrue
to enable the server.
-
setHttpServerConf
public AzkarraApplication setHttpServerConf(Conf httpServerConf)
Sets the HTTP server configuration.- Parameters:
httpServerConf
- the http server configuration.- Returns:
- this
AzkarraApplication
instance.
-
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.
-
addConfigEntryLoader
public AzkarraApplication addConfigEntryLoader(ApplicationConfigEntryLoader configEntryLoader)
Adds a newApplicationConfigEntryLoader
to be used for reading the application configuration.- Parameters:
configEntryLoader
- theApplicationConfigEntryLoader
to be added.- 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.
-
-