Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Ignite modules can provide endpoints that will be included into the netty server by RestComponent at the build time. For example, the configuration module exposes /management/v1/configuration/node by declaring NodeConfigurationController and NodeConfigurationRestFactory. Then ignite-configuration module is added as a dependency for the ignite-rest module. And NodeConfigurationController is added to @OpenAPIInclude annotation in RestComponent.

"build time" means that micronaut annotation processor will discover classes annotated with io.micronaut.http.annotation.Controller.This is done by default but it is always possible to register request handlers at runtime.


Implementation example


Code Block
languagejava
titleRestComponent
@OpenAPIDefinition(
        info = @Info(
                title = "Ignite REST module",
                version = "3.0.0-alpha",
                license = @License(name = "Apache 2.0", url = "https://ignite.apache.org"),
                contact = @Contact(email = "dev@ignite.apache.org")
        )
)
@OpenAPIInclude(classes = {ClusterConfigurationController.class, NodeConfigurationController.class}) // include to openapi specification
public class RestComponent implements IgniteComponent {
    // ...

    public RestComponent(List<MicronautFactory> micronautFactories, RestConfiguration restConfiguration) {
        // register all factories in micronaut context
    }

    @Override
    public void start() {
       // start REST server
    }

...