modules/jooby-reactor/src/main/java/org/jooby/reactor/Reactor.java
@SuppressWarnings("unchecked")
  public static Route.Mapper<Object> reactor(final Function<Flux, Flux> flux,
    final Function<Mono, Mono> mono) {
    requireNonNull(flux, "Flux's adapter is required.");
    requireNonNull(mono, "Mono's adapter is required.");
    return Route.Mapper.create("reactor", value -> {
      if (value instanceof Flux) {
        return new Deferred(deferred -> flux.apply((Flux) value)
          .consume(deferred::set, deferred::set));
      }
      if (value instanceof Mono) {
        return new Deferred(deferred -> mono.apply((Mono) value)
          .consume(deferred::set, deferred::set));
      }
      return value;
    });
  }
@SuppressWarnings("unchecked")
  public static Route.Mapper<Object> reactor(final Function<Flux, Flux> flux,
    final Function<Mono, Mono> mono) {
    requireNonNull(flux, "Flux's adapter is required.");
    requireNonNull(mono, "Mono's adapter is required.");
    return Route.Mapper.create("reactor", value -> {
      if (value instanceof Flux) {
        return new Deferred(deferred -> flux.apply((Flux) value)
          .consume(deferred::set, deferred::set));
      }
      if (value instanceof Mono) {
        return new Deferred(deferred -> mono.apply((Mono) value)
          .consume(deferred::set, deferred::set));
      }
      return value;
    });
  }
Map a reactor object like {@link Flux} or {@link Mono} into a {@link Deferred} object.

<pre>{@code
...
import org.jooby.reactor.Reactor;
...

{
with(() -> {
get("/lux", req -> Flux...);

get("/mono", req -> Mono...);

}).map(Reactor.reactor(
flux -> flux.publishOn(Computations.concurrent()),
mono -> mono.publishOn(Computations.concurrent()));
}
}</pre>

@param flux A flux adapter.
@param mono A mono adapter.
@return A new mapper.