io.vertx.core.spi

## Interface VerticleFactory

- All Known Implementing Classes:
    GroovyVerticleFactory, HttpSecureServiceFactory, HttpServiceFactory, MavenVerticleFactory, ServiceVerticleFactory

      public interface VerticleFactory

  Has responsibility for creating verticle instances.

  Implementations of this are responsible for creating verticle written in various different JVM languages and for other purposes.

  Author:
    Tim Fox

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default void` | `close()` Close the factory.
    `void` | `createVerticle(String verticleName, ClassLoader classLoader, Promise<Callable<Verticle>> promise)` Create a verticle instance.
    `default void` | `init(Vertx vertx)` Initialise the factory
    `default int` | `order()` The order of the factory.
    `String` | `prefix()`
    `static String` | `removePrefix(String identifer)` Helper method to remove a prefix from an identifier string

- - ### Method Detail

    - #### removePrefix

          static String removePrefix(String identifer)

      Helper method to remove a prefix from an identifier string
      Parameters:
        `identifer` - the identifier
      Returns:
        The identifier without the prefix (if it had any)

    - #### order

          default int order()

      The order of the factory. If there is more than one matching verticle they will be tried in ascending order.
      Returns:
        the order

    - #### init

          default void init(Vertx vertx)

      Initialise the factory
      Parameters:
        `vertx` - The Vert.x instance

    - #### close

          default void close()

      Close the factory. The implementation must release all resources.

    - #### prefix

          String prefix()

      Returns:
        The prefix for the factory, e.g. "java", or "js".

    - #### createVerticle

          void createVerticle(String verticleName,
                              ClassLoader classLoader,
                              Promise<Callable<Verticle>> promise)

      Create a verticle instance. If this method is likely to be slow (e.g. Ruby or JS verticles which might have to start up a language engine) then make sure it is run on a worker thread by `Vertx.executeBlocking(io.vertx.core.Handler<io.vertx.core.Promise<T>>, boolean, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)`.
      Parameters:
        `verticleName` - The verticle name
        `classLoader` - The class loader
        `promise` - the promise to complete with the result

Copyright © 2024 Eclipse. All rights reserved.