...
REST ignite-rest module will have additional dependencies:
any other module that wants to expose an enpoint:
NOTE: modules that expose api do not include micronaut-http-netty.
Info | ||
---|---|---|
| ||
IMPORTANT: additional dependencies here mean that Java Code Style Best Practices (3d party libraries) are going to be adjusted: Micrionaut for REST, Swagger for Open API annotations, and Micronaut serde for REST serialization. |
...
TBD
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.
Code Block | ||||
---|---|---|---|---|
| ||||
@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 = "user@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
} |
Code Block | ||||
---|---|---|---|---|
| ||||
@Factory
public class NodeConfigurationRestFactory implements MicronautFactory {
// define all beans needed
} |
Here is an example of GET /management/v1/configuration/node endpoint (defined in configuration module):
Code Block | ||||
---|---|---|---|---|
| ||||
@Controller("/management/v1/configuration/node") @Tag(name = "nodeConfiguration") public class NodeConfigurationController { //… @Operation(operationId = "getNodeConfiguration") @ApiResponse(responseCode = "200", content = @Content(mediaType = MediaType.TEXT_PLAIN, schema = @Schema(type = "string")), description = "Whole node configuration") @Produces(MediaType.TEXT_PLAIN) @Get public String getConfiguration() { return …; } |
...