Package io.vertx.lang.groovy
Class ScriptVerticle
- java.lang.Object
-
- io.vertx.core.AbstractVerticle
-
- io.vertx.lang.groovy.ScriptVerticle
-
- All Implemented Interfaces:
Deployable
,Verticle
public class ScriptVerticle extends AbstractVerticle
A Vert.x native verticle wrapping a Groovy script, the script will be executed when the Verticle starts. When the script defines a no arg accessiblevertxStop
method, this method will be invoked when the verticle stops. Before the script starts the following objects are bound in the script binding:vertx
: theVertx
objectdeploymentID
: the deploymentID of this Verticleconfig
: the Verticle config as aMap<String, Object>
- Author:
- Julien Viet
-
-
Field Summary
-
Fields inherited from class io.vertx.core.AbstractVerticle
context, vertx
-
-
Constructor Summary
Constructors Constructor Description ScriptVerticle(groovy.lang.Script script)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
start(Promise<Void> startPromise)
Start the verticle instance.void
stop(Promise<Void> stopPromise)
Stop the verticle instance.-
Methods inherited from class io.vertx.core.AbstractVerticle
config, deploy, deploymentID, getVertx, init, processArgs, start, stop, undeploy
-
-
-
-
Method Detail
-
start
public void start(Promise<Void> startPromise) throws Exception
Start the verticle instance.Vert.x calls this method when deploying the instance. You do not call it yourself.
A future is passed into the method, and when deployment is complete the verticle should either call
Promise.complete(T, java.lang.Throwable)
orPromise.fail(java.lang.Throwable)
the future.- Specified by:
start
in interfaceVerticle
- Overrides:
start
in classAbstractVerticle
- Parameters:
startPromise
- the future- Throws:
Exception
-
stop
public void stop(Promise<Void> stopPromise) throws Exception
Stop the verticle instance.Vert.x calls this method when un-deploying the instance. You do not call it yourself.
A future is passed into the method, and when un-deployment is complete the verticle should either call
Promise.complete(T, java.lang.Throwable)
orPromise.fail(java.lang.Throwable)
the future.- Specified by:
stop
in interfaceVerticle
- Overrides:
stop
in classAbstractVerticle
- Parameters:
stopPromise
- the future- Throws:
Exception
-
-