Build reactive HTTP handlers, clients, data repositories, which are implemented at compile-time, reducing memory consumption.
Read more at the Supported Features section.
RxMicro is a non-blocking framework,
which supports the reactive programming style only.
This means your app can handle a lot of concurrency using a small number of kernel threads.
Any blocking operations are not supported!
(For using of the blocking operations You must choose any other framework or library).
The RxMicro framework contains several different components designed to make it easier for you to write compelling reactive applications using Java 11 or higher.
The RxMicro framework uses the
Java annotation processors
.
This means during compiling Your microservice project, the RxMicro framework reads the
RxMicro Annotations
and generates additional classes that contain the standard logic: registration of
URL mapping, serialization, and deserialization of Java classes to JSON format, validation of HTTP requests,
generation of project documentation, etc.
Thus, the runtime of Your microservice, which uses the RxMicro framework, does not contain any redundant adapters, proxies,
and a slow reflection.
Read more at User Guide REST Controller
final class HelloController {
@GET("/")
CompletableFuture<Response> handle() {
return CompletableFuture.supplyAsync(() ->
new Response("Hello World!"));
}
}
Read more at User Guide REST Client
@RestClient
interface HelloClient {
@GET("/")
Single<Response> handle();
}
Read more at User Guide Validation
final class HelloController {
@PUT("/")
void handle(final @Email String email) {
sendNotification(email);
}
}
Read more at User Guide Project Documentation
module quick.start {
requires rxmicro.rest.server.netty;
requires rxmicro.rest.server.exchange.json;
requires static rxmicro.documentation.asciidoctor;
}
Read more at User Guide Postgre SQL Data Repositories
@PostgreSQLRepository
interface DataRepository {
@Select("SELECT * FROM ${table} WHERE id = ?")
Mono<Product> findProduct(long id);
}
Read more at User Guide Mongo Data Repositories
@MongoRepository(collection = "product")
interface DataRepository {
@Find(query = "{_id: ?}")
Mono<Product> findProduct(long id);
}
Read more at User Guide Contexts and Dependency Injection
final class BusinessService {
@Inject
DataRepository repository;
@PostConstruct
void postConstruct() {
}
Mono<Long> buy(final Order order) {
return repository.createOrder(order)
.flatMap(id -> sendEmail(order)
.thenReturn(id)
);
}
}
Read more at User Guide Testing
@RxMicroRestBasedMicroServiceTest(Controller.class)
final class ControllerTest {
private BlockingHttpClient blockingHttpClient;
@Test
void Should_return_Hello_World_message() {
final ClientHttpResponse response =
blockingHttpClient.get("/");
assertEquals(
jsonObject("message", "Hello World!"),
response.body()
);
assertEquals(200, response.statusCode());
}
}
Read more at User Guide Uber Jar
:$ ls -lh
-rw-rw-r-- 1,4M uber-jar-1.0-SNAPSHOT.jar
-rw-rw-r-- 9,8K original-uber-jar-1.0-SNAPSHOT.jar
:$ java -jar unnamed-module-uber-jar-1.0-SNAPSHOT.jar
Server started at 0.0.0.0:8080 in 500 millis
Read more at User Guide Using GraalVM
:$ ls -lh
-rw-rw-r-- 1,4M uber-jar-1.0-SNAPSHOT.jar
-rwxrwxr-x 17M HelloWorldMicroService
:$ ./HelloWorldMicroService
Server started at 0.0.0.0:8080 in 5 millis