Class MutinyHelper

java.lang.Object
io.smallrye.mutiny.vertx.MutinyHelper

public class MutinyHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Executor
    blockingExecutor(io.vertx.core.Vertx vertx)
    Create an executor for a Vertx object, actions can be blocking, they are not executed on Vert.x event loop.
    static Executor
    blockingExecutor(io.vertx.core.Vertx vertx, boolean ordered)
    Create an executor for a Vertx object, actions can be blocking, they are not executed on Ver.tx event loop.
    static Executor
    blockingExecutor(io.vertx.core.WorkerExecutor worker)
    Create a scheduler for a WorkerExecutor object, actions are executed on the threads of this executor.
    static <T> io.vertx.core.Handler<T>
    convertConsumer(Consumer<T> mutinyConsumer)
    Convert a consumer for a generated Mutiny type to a handler of the same type.
    static <BARE, MUTINY>
    io.vertx.core.Handler<BARE>
    convertHandler(io.vertx.core.Handler<MUTINY> mutinyHandler, Function<BARE,MUTINY> mapper)
    Convert a handler for a generated Mutiny type to a handler for the corresponding core type.
    static Executor
    executor(io.vertx.core.Context context)
    Create an executor for a Context, actions are executed on the event loop of this context.
    static Executor
    executor(io.vertx.core.Vertx vertx)
    Create an executor for a Vertx object, actions are executed on the event loop.
    static <T> WriteStreamSubscriber<T>
    toSubscriber(io.vertx.core.streams.WriteStream<T> stream)
    Adapts a Vert.x WriteStream to a Mutiny Flow.Subscriber.
    static <R, T> WriteStreamSubscriber<R>
    toSubscriber(io.vertx.core.streams.WriteStream<T> stream, Function<R,T> mapping)
    Like toSubscriber(WriteStream), except the provided mapping function is applied to each item.
    static Class
    unwrap(Class<?> type)
    Unwrap the type used in Mutiny.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MutinyHelper

      public MutinyHelper()
  • Method Details

    • executor

      public static Executor executor(io.vertx.core.Vertx vertx)
      Create an executor for a Vertx object, actions are executed on the event loop.
      Parameters:
      vertx - the vert.x object
      Returns:
      the executor
    • executor

      public static Executor executor(io.vertx.core.Context context)
      Create an executor for a Context, actions are executed on the event loop of this context.
      Parameters:
      context - the context object
      Returns:
      the executor
    • blockingExecutor

      public static Executor blockingExecutor(io.vertx.core.Vertx vertx)
      Create an executor for a Vertx object, actions can be blocking, they are not executed on Vert.x event loop.
      Parameters:
      vertx - the ver.tx object
      Returns:
      the executor
    • blockingExecutor

      public static Executor blockingExecutor(io.vertx.core.Vertx vertx, boolean ordered)
      Create an executor for a Vertx object, actions can be blocking, they are not executed on Ver.tx event loop.
      Parameters:
      vertx - the vert.x object
      ordered - if true then if when tasks are scheduled several times on the same context, the executions for that context will be executed serially, not in parallel. if false then they will be no ordering guarantees
      Returns:
      the executor
    • blockingExecutor

      public static Executor blockingExecutor(io.vertx.core.WorkerExecutor worker)
      Create a scheduler for a WorkerExecutor object, actions are executed on the threads of this executor.
      Parameters:
      worker - the worker executor object
      Returns:
      the executor
    • unwrap

      public static Class unwrap(Class<?> type)
      Unwrap the type used in Mutiny.
      Parameters:
      type - the type to unwrap
      Returns:
      the unwrapped type
    • convertHandler

      public static <BARE, MUTINY> io.vertx.core.Handler<BARE> convertHandler(io.vertx.core.Handler<MUTINY> mutinyHandler, Function<BARE,MUTINY> mapper)
      Convert a handler for a generated Mutiny type to a handler for the corresponding core type.
    • convertConsumer

      public static <T> io.vertx.core.Handler<T> convertConsumer(Consumer<T> mutinyConsumer)
      Convert a consumer for a generated Mutiny type to a handler of the same type.
    • toSubscriber

      public static <T> WriteStreamSubscriber<T> toSubscriber(io.vertx.core.streams.WriteStream<T> stream)
      Adapts a Vert.x WriteStream to a Mutiny Flow.Subscriber.

      After subscription, the original WriteStream handlers should not be used anymore as they will be used by the adapter.

      Parameters:
      stream - the stream to adapt
      Returns:
      the adapted Flow.Subscriber
    • toSubscriber

      public static <R, T> WriteStreamSubscriber<R> toSubscriber(io.vertx.core.streams.WriteStream<T> stream, Function<R,T> mapping)
      Like toSubscriber(WriteStream), except the provided mapping function is applied to each item.