Class TelestionVerticle<T extends TelestionConfiguration>
- Type Parameters:
T
- the type of your Configuration class
- All Implemented Interfaces:
io.vertx.core.Verticle
- Direct Known Subclasses:
DefaultConfigVerticle
,GenericSimpleCommandHandler
,HelloWorld
,PingVerticle
,PongVerticle
,PositionPublisher
,Publisher
,RandomPositionPublisher
,Receiver
,Requester
,Responder
,SayHello
,SimpleCommandHandler
,SystemInfoVerticle
,TestVerticle
It's extends the AbstractVerticle
from Vert.x to add support for default configurations
and type-safe usage of the configuration JSON object provided by Vert.x.
-
Field Summary
FieldsFields inherited from class io.vertx.core.AbstractVerticle
context, vertx
-
Constructor Summary
ConstructorsConstructorDescriptionSame asTelestionVerticle(boolean)
but enables loading of default configuration if possible.TelestionVerticle(boolean skipDefaultConfigLoading)
Creates a new Telestion verticle and tries to load the default configuration from the specified configuration class. -
Method Summary
Modifier and TypeMethodDescriptionio.vertx.core.json.JsonObject
config()
Block the usage ofconfig()
in inheriting classes.Get the verticle configuration in the Configuration type format.Get the Configuration Class type from the inheriting class.Get the default verticle configuration in the Configuration type format.io.vertx.core.json.JsonObject
Get the verticle configuration in a generic format.io.vertx.core.json.JsonObject
Get the default verticle configuration in a generic format.void
onStart()
Starts the verticle.void
Starts the verticle.void
onStop()
Stops the verticle.void
Stops the verticle.void
setDefaultConfig(io.vertx.core.json.JsonObject defaultConfig)
Set the default verticle configuration and update the verticle configuration.void
setDefaultConfig(T defaultConfig)
Set the default verticle configuration and update the verticle configuration.void
start()
void
void
stop()
void
Methods inherited from class io.vertx.core.AbstractVerticle
deploymentID, getVertx, init, processArgs
-
Field Details
-
logger
protected final org.slf4j.Logger loggerThe default logger instance.
-
-
Constructor Details
-
TelestionVerticle
public TelestionVerticle(boolean skipDefaultConfigLoading)Creates a new Telestion verticle and tries to load the default configuration from the specified configuration class.- Parameters:
skipDefaultConfigLoading
- whentrue
the loading of the default configuration is skipped
-
TelestionVerticle
public TelestionVerticle()Same asTelestionVerticle(boolean)
but enables loading of default configuration if possible.
-
-
Method Details
-
getConfigType
Get the Configuration Class type from the inheriting class.- Returns:
- the Configuration Class type
-
start
- Specified by:
start
in interfaceio.vertx.core.Verticle
- Overrides:
start
in classio.vertx.core.AbstractVerticle
- Throws:
Exception
-
start
- Overrides:
start
in classio.vertx.core.AbstractVerticle
- Throws:
Exception
-
stop
- Specified by:
stop
in interfaceio.vertx.core.Verticle
- Overrides:
stop
in classio.vertx.core.AbstractVerticle
- Throws:
Exception
-
stop
- Overrides:
stop
in classio.vertx.core.AbstractVerticle
- Throws:
Exception
-
onStart
Starts the verticle.This is called by Vert.x when the verticle instance is deployed. Please don't call it yourself.
If your verticle needs a start routine which takes some time to finish, then complete the start promise some time later.
This is the asynchronous part to the
onStart()
method.- Parameters:
startPromise
- a promise which should be called when verticle start is complete- Throws:
Exception
-
onStart
Starts the verticle.This is called by Vert.x when the verticle instance is deployed. Please don't call it yourself.
If your verticle only does synchronous start tasks, use this method.
This is the synchronous part to the
onStart(Promise)
method.- Throws:
Exception
-
onStop
Stops the verticle.This is called by Vert.x when the verticle instance is un-deployed. Please don't call it yourself.
If your verticle needs a stop routine which takes some time to finish, then complete the stop promise some time later.
This is the asynchronous part to the
onStop()
method.- Parameters:
stopPromise
- a promise which should be called when verticle stop is complete- Throws:
Exception
-
onStop
Stops the verticle.This is called by Vert.x when the verticle instance is un-deployed. Please don't call it yourself.
If your verticle only does synchronous stop tasks, use this method.
This is the synchronous part to the
onStop(Promise)
method.- Throws:
Exception
-
setDefaultConfig
public void setDefaultConfig(io.vertx.core.json.JsonObject defaultConfig)Set the default verticle configuration and update the verticle configuration.- Parameters:
defaultConfig
- the new default verticle configuration
-
setDefaultConfig
Set the default verticle configuration and update the verticle configuration.- Parameters:
defaultConfig
- the new default verticle configuration
-
getDefaultConfig
Get the default verticle configuration in the Configuration type format.Returns
null
when no type viagetConfigType()
is given.- Returns:
- the default verticle configuration
-
getGenericDefaultConfig
public io.vertx.core.json.JsonObject getGenericDefaultConfig()Get the default verticle configuration in a generic format.- Returns:
- the default verticle configuration
-
getConfig
Get the verticle configuration in the Configuration type format.Returns
null
when no type viagetConfigType()
is given.- Returns:
- the verticle configuration
-
getGenericConfig
public io.vertx.core.json.JsonObject getGenericConfig()Get the verticle configuration in a generic format.- Returns:
- the verticle configuration
-
config
public final io.vertx.core.json.JsonObject config()Block the usage ofconfig()
in inheriting classes.- Overrides:
config
in classio.vertx.core.AbstractVerticle
- Returns:
- the verticle configuration from vertx merged with the default configuration
-