Micronaut
Last updated
Last updated
is a modern, JVM-based, fullstack framework for building modular, easily testable microservice and serverless applications. Micronaut provides a simple compile-time aspect-oriented programming API, which is very similar to Spring, but does not use reflection.
Kilua RPC provides a single module for Micronaut, kilua-rpc-micronaut
, which uses Micronaut dependency injection to access services implementations. You need to add this module to your project.
The implementation of the service class comes down to implementing required interface methods and making it a Micronaut @Prototype
component.
Micronaut IoC (Inversion of Control) allows you to inject resources and other Micronaut components into your service class. You can use standard @Inject
annotation or constructor parameter injection.
Kilua RPC allows you to inject HttpRequest
Micronaut object (which can also give you access to the user session, if it is configured)
Since Micronaut architecture is asynchronous and non-blocking, you should never block a thread in your application code. If you have to use some blocking code (e.g. blocking I/O, JDBC) always use the dedicated coroutine dispatcher.
To allow Kilua RPC work with Micronaut you have to pass all instances of the RpcServiceManager
objects (defined in common code) to the Micronaut environment. You do this by defining a provider method for the RpcManagers
instance in the main application class. You can use getAllServiceManagers()
method to simplify your code.
To secure your application you can use different Micronaut components and ready to use modules. See guide for details. You can apply different security settings for different services by defining custom SecurityRule
using Kilua RPC matches
helper function.