RxMicro is a modern, full-stack framework for building reactive microservices using Java 11

What is RxMicro?

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.

Benefits

Declarative programming using annotations.

Build reactive HTTP handlers, clients, data repositories, which are implemented at compile-time, reducing memory consumption.

Read more at the Supported Features section.

CDI by demand.

For simplest microservices CDI is often redundant, therefore the RxMicro framework allows to enable/disable CDI by demand.

For Unit tests of components, which don't use CDI, the RxMicro framework introduces the @Alternative feature.

Human-readable generated code.

For reliable systems, a developer must control everything. For these purposes, the RxMicro framework generates a human-readable code.

Thus, a developer can read the generated code or even override it if it will be necessary.

Inefficient source code verifier.

The RxMicro framework can run as many verifications as needed because the Java annotation processor works at compile-time (Not at startup time or runtime).

Thus, the quality of Your code can be verified as quickly as possible.

Runtime without reflection.

Serialization/Deserialization in 28/17 times faster without reflection:

    Benchmark                    Score  Units
readDirectField         753348.188 ops/ms
readUsingReflection      26241.478 ops/ms
writeDirectField        344623.904 ops/ms
writeUsingReflection     19430.735 ops/ms
The RxMicro framework is lightweight.
Component Size
Alpine Base Docker Image 5.6 Mb
Alpine JRE 11 36.7 Mb
Netty Runtime Libs 2.6 Mb
RxMicro Libs 0.328 Mb
Reactor Core Lib 1.5 Mb
RxJava3 Lib 2.5 Mb
Fast startup time.

Start in 500 millis is an average metric without tuning of JVM or Netty.

(Start in 5 millis is an average metric using GraalVM native image).

Reduced memory footprint.

Requires a minimum 3Mb of Heap (-Xmx3M -Xms3M) for a successful start without tuning of JVM or Netty.

Runtime maxRSS
JVM Runtime 65 Mb
GraalVM native image 17 Mb

Supported Features

Declarative handlers of HTTP requests

Read more at User Guide REST Controller

    final class HelloController {

    @GET("/")
    CompletableFuture<Response> handle() {
        return CompletableFuture.supplyAsync(() ->
                new Response("Hello World!"));
    }
}
Declarative REST Client

Read more at User Guide REST Client

    @RestClient
interface HelloClient {

    @GET("/")
    Single<Response> handle();

}
    
Request Validation

Read more at User Guide Validation

    final class HelloController {
    @PUT("/")
    void handle(final @Email String email) {
        sendNotification(email);
    }
}
REST MicroServices Documentation

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;
}
Declarative PostgreSQL Data Repositories

Read more at User Guide Postgre SQL Data Repositories

    @PostgreSQLRepository
interface DataRepository {

    @Select("SELECT * FROM ${table} WHERE id = ?")
    Mono<Product> findProduct(long id);
}
Declarative Mongo Data Repositories

Read more at User Guide Mongo Data Repositories

    @MongoRepository(collection = "product")
interface DataRepository {

    @Find(query = "{_id: ?}")
    Mono<Product> findProduct(long id);
}
Contexts and Dependency Injection

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)
                );
    }
}
Fast and Easy Testing

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());
    }
}
Uber Jar

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
    
GraalVM Native Image

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
    

Reactive Library Support