Class ContextualEmitterImpl<T>

java.lang.Object
io.smallrye.reactive.messaging.providers.extension.AbstractEmitter<T>
io.quarkus.smallrye.reactivemessaging.runtime.ContextualEmitterImpl<T>
All Implemented Interfaces:
ContextualEmitter<T>, io.smallrye.reactive.messaging.EmitterType, io.smallrye.reactive.messaging.MessagePublisherProvider<T>

public class ContextualEmitterImpl<T> extends io.smallrye.reactive.messaging.providers.extension.AbstractEmitter<T> implements ContextualEmitter<T>
  • Field Summary

    Fields inherited from class io.smallrye.reactive.messaging.providers.extension.AbstractEmitter

    internal, name, NO_SUBSCRIBER_EXCEPTION, publisher, synchronousFailure
  • Constructor Summary

    Constructors
    Constructor
    Description
    ContextualEmitterImpl(io.smallrye.reactive.messaging.EmitterConfiguration configuration, long defaultBufferSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> io.smallrye.mutiny.Uni<T>
    emitter(Consumer<io.smallrye.mutiny.subscription.UniEmitter<? super T>> emitter)
     
    io.smallrye.mutiny.Uni<Void>
    send(T payload)
    Sends a payload to the channel.
    void
    sendAndAwait(T payload)
    Sends a payload to the channel.
    io.smallrye.mutiny.subscription.Cancellable
    sendAndForget(T payload)
    Sends a payload to the channel without waiting for acknowledgement.
    <M extends org.eclipse.microprofile.reactive.messaging.Message<? extends T>>
    io.smallrye.mutiny.Uni<Void>
    sendMessage(M msg)
    Sends a message to the channel.
    <M extends org.eclipse.microprofile.reactive.messaging.Message<? extends T>>
    void
    Sends a message to the channel.
    <M extends org.eclipse.microprofile.reactive.messaging.Message<? extends T>>
    io.smallrye.mutiny.subscription.Cancellable
    Sends a message to the channel without waiting for acknowledgement.
    static <T, R> io.smallrye.mutiny.Uni<R>
    transformToUni(io.smallrye.mutiny.Uni<T> upstream, Function<? super T,io.smallrye.mutiny.Uni<? extends R>> mapper)
     

    Methods inherited from class io.smallrye.reactive.messaging.providers.extension.AbstractEmitter

    complete, emit, error, getPublisher, hasRequests, isCancelled, verify

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.quarkus.smallrye.reactivemessaging.runtime.ContextualEmitter

    complete, error, hasRequests, isCancelled
  • Constructor Details

    • ContextualEmitterImpl

      public ContextualEmitterImpl(io.smallrye.reactive.messaging.EmitterConfiguration configuration, long defaultBufferSize)
  • Method Details

    • sendAndAwait

      public void sendAndAwait(T payload)
      Description copied from interface: ContextualEmitter
      Sends a payload to the channel.

      A Message object will be created to hold the payload.

      Execution will block waiting for the resulting Message to be acknowledged before returning.

      Specified by:
      sendAndAwait in interface ContextualEmitter<T>
      Parameters:
      payload - the thing to send, must not be null
    • sendAndForget

      public io.smallrye.mutiny.subscription.Cancellable sendAndForget(T payload)
      Description copied from interface: ContextualEmitter
      Sends a payload to the channel without waiting for acknowledgement.

      A Message object will be created to hold the payload.

      Specified by:
      sendAndForget in interface ContextualEmitter<T>
      Parameters:
      payload - the thing to send, must not be null
      Returns:
      the Cancellable from the subscribed Uni.
    • send

      public io.smallrye.mutiny.Uni<Void> send(T payload)
      Description copied from interface: ContextualEmitter
      Sends a payload to the channel.

      A Message object will be created to hold the payload and the returned Uni can be subscribed to for triggering the send. When subscribed, a null item will be passed to the Uni when the Message is acknowledged. If the Message is never acknowledged, then the Uni will never be completed.

      The Message will not be sent to the channel until the Uni has been subscribed to:

       emitter.send("a").subscribe().with(x -> {
       });
       
      Specified by:
      send in interface ContextualEmitter<T>
      Parameters:
      payload - the thing to send, must not be null
      Returns:
      the Uni, that requires subscription to send the Message.
    • sendMessageAndAwait

      public <M extends org.eclipse.microprofile.reactive.messaging.Message<? extends T>> void sendMessageAndAwait(M msg)
      Description copied from interface: ContextualEmitter
      Sends a message to the channel. Execution will block waiting for the resulting Message to be acknowledged before returning.
      Specified by:
      sendMessageAndAwait in interface ContextualEmitter<T>
      Type Parameters:
      M - the Message type
      Parameters:
      msg - the Message to send, must not be null
    • sendMessageAndForget

      public <M extends org.eclipse.microprofile.reactive.messaging.Message<? extends T>> io.smallrye.mutiny.subscription.Cancellable sendMessageAndForget(M msg)
      Description copied from interface: ContextualEmitter
      Sends a message to the channel without waiting for acknowledgement.
      Specified by:
      sendMessageAndForget in interface ContextualEmitter<T>
      Type Parameters:
      M - the Message type
      Parameters:
      msg - the Message to send, must not be null
      Returns:
      the Cancellable from the subscribed Uni.
    • sendMessage

      @CheckReturnValue public <M extends org.eclipse.microprofile.reactive.messaging.Message<? extends T>> io.smallrye.mutiny.Uni<Void> sendMessage(M msg)
      Description copied from interface: ContextualEmitter
      Sends a message to the channel.
      Specified by:
      sendMessage in interface ContextualEmitter<T>
      Type Parameters:
      M - the Message type
      Parameters:
      msg - the Message to send, must not be null
      Returns:
      the Uni, that requires subscription to send the Message.
    • emitter

      public static <T> io.smallrye.mutiny.Uni<T> emitter(Consumer<io.smallrye.mutiny.subscription.UniEmitter<? super T>> emitter)
    • transformToUni

      public static <T, R> io.smallrye.mutiny.Uni<R> transformToUni(io.smallrye.mutiny.Uni<T> upstream, Function<? super T,io.smallrye.mutiny.Uni<? extends R>> mapper)