Skip to content

v0.62 of Microserver : A plugin architecture and Microserver goes Reactive

Compare
Choose a tag to compare
@johnmcclean johnmcclean released this 05 Aug 14:42
· 783 commits to master since this release

New in Microserver v0.62

A new plugin Architecture and 11 plugins, with lots more to follow!

  1. micro-reactive - reactive programming via Pipes (Queues & Topics) and Asyncrhonous Streams.
  2. micro-events - capture scheduled jobs / active requests
  3. micro-data - Spring Data, Hibernate and JDBC
  4. micro-metrics - Dropwizard metrics for Spring
  5. micro-swagger
  6. micro-client - Async Rest Clients (NIO & Thread based)
  7. micro-grizzly - Grizzly Web server
  8. micro-jersey - Jersey jax-rs implementation
  9. micro-guava - Guava support (Jackson & Event bus configuration)
  10. micro-ip-tracker
  11. micro-cors

Other stuff!

  1. Users can create custom plugins
  2. Reactive Microserver first phase, with Reactive mixin that makes it easy to create performance optimised simple-react Streams
  3. simple-react version upgraded to 0.98
  4. Grizzly upgraded to version 2.3.21
  5. Jersey upgraded to version 2.19

Reactive Microserver

IO Bound Example, implement Reactive on your Rest Resource to inject Reactive capabilities!

@GET
@Produces("application/json")
public void mainfest(@Suspended AsyncResponse asyncResponse, @Context ServletContext context) {

    this.ioStream().of("/META-INF/MANIFEST.MF")
                .map(url->context.getResourceAsStream(url))
                .map(this::getManifest)
                .peek(result->asyncResponse.resume(result))
                .run();

}

Get a thread per I/O task, but each event chain operates with thread affinity for performance reasons.

Pipes example

Create a bounded wait free Queue called "test"

    LazyFutureStream<String> stream = Pipes.registerForIO("test", QueueFactories.
                                        <String>boundedNonBlockingQueue(100)
                                            .build());

Create a batch processing Stream

    stream.sync() //do not distribute the next task to a task executor
          .filter(it->it!=null)
          .async() //now fan out across threads using a task executor
          .batchBySize(20)
          .sync() //any additional processing to continue on executing thread
          .map(this::save)
          .forEach(Logger::info);
    new MicroserverApp(()-> "simple-app").run();

In our Rest Resources pipe information to our processing Stream

  @Path("/status")
  @Rest
  public class PipesStatusResource implements Reactive {

      volatile int next=0;


      @GET
      @Produces("text/plain")
      @Path("/ping")
      public String ping() {
                this.enqueue("test",nextData());
                return "ok";
      }


  }

Getting Microserver

Maven dependency

Microserver core

<dependency>
  <groupId>com.aol.microservices</groupId>
  <artifactId>micro-grizzly-with-jersey</artifactId>
  <version>0.62</version>
</dependency>

Microserver Spring Boot

<dependency>
  <groupId>com.aol.microservices</groupId>
  <artifactId>micro-boot</artifactId>
  <version>0.62</version>
</dependency>

Other modules are available in Maven Central

Gradle dependency

Microserver core

 compile group: 'com.aol.microservices', name:'micro-grizzly-with-jersey', version:'0.62'

Microserver Spring Boot

  compile group: 'com.aol.microservices', name:'micro-boot', version:'0.62'

Java Doc : Microserver Core
Java Doc : Microserver Boot
Java Doc : Microserver Data
Java Doc : Microserver Grizzly
Java Doc : Microserver Jersey
Java Doc : Microserver Swagger
Java Doc : Microserver Metrics
Java Doc : Microserver Reactive
Java Doc : Microserver Events