io.vertx.lang.groovy

## Class ScriptVerticle

- java.lang.Object
- - io.vertx.core.AbstractVerticle
  - - io.vertx.lang.groovy.ScriptVerticle

- All Implemented Interfaces:
    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 accessible `vertxStop` method, this method will be invoked when the verticle stops. Before the script starts the following objects are bound in the script binding:
  - `vertx`: the `Vertx` object
  - `deploymentID`: the deploymentID of this Verticle
  - `config`: the Verticle config as a `Map<String, Object>`
  Author:
    Julien Viet

- - ### Field Summary

    - ### Fields inherited from class io.vertx.core.AbstractVerticle

      `context, vertx`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScriptVerticle(groovy.lang.Script script)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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, deploymentID, getVertx, init, processArgs, start, stop`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ScriptVerticle

          public ScriptVerticle(groovy.lang.Script script)

  - ### 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)` or `Promise.fail(java.lang.Throwable)` the future.

      Specified by:
        `start` in interface `Verticle`
      Overrides:
        `start` in class `AbstractVerticle`
      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)` or `Promise.fail(java.lang.Throwable)` the future.

      Specified by:
        `stop` in interface `Verticle`
      Overrides:
        `stop` in class `AbstractVerticle`
      Parameters:
        `stopPromise` - the future
      Throws:
        `Exception`

Copyright © 2024 Eclipse. All rights reserved.