Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

1.2.0.Final

Latest
Compare
Choose a tag to compare
@mkouba mkouba released this 29 Sep 14:30
· 13 commits to master since this release

AsyncReference example

@ApplicationScoped
class Hello {

    @Inject
    AsynReference<ServiceWithBlockingInit> service;

    CompletionStage<String> hello() {
        return service.thenApply(s -> "Hello" + s.getName() + "!");
    }
}

AsyncWorker example

@ApplicationScoped
public class Hello {

    @Inject
    AsyncWorker worker;

    @Inject
    Service service;

    CompletionStage<String> hello() {
        return worker.performBlocking(service::getMessageFromDb).thenApply(m -> "Hello " + m + "!");
    }
}

@WebRoute observer method example

@ApplicationScoped
class Hello {

   @WebRoute("/hello")
   void hello(@Observes RoutingContext ctx) {
     ctx.response().setStatusCode(200).end("Hello!");
   }
 }