Class MessageProducer<T>

java.lang.Object
io.vertx.mutiny.core.eventbus.MessageProducer<T>
All Implemented Interfaces:
MutinyDelegate

public class MessageProducer<T> extends Object implements MutinyDelegate
Represents a stream of message that can be written to.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

  • Field Details

  • Constructor Details

    • MessageProducer

      public MessageProducer(io.vertx.core.eventbus.MessageProducer delegate)
    • MessageProducer

      public MessageProducer(Object delegate, TypeArg<T> typeArg_0)
    • MessageProducer

      public MessageProducer(io.vertx.core.eventbus.MessageProducer delegate, TypeArg<T> typeArg_0)
  • Method Details

    • getDelegate

      public io.vertx.core.eventbus.MessageProducer getDelegate()
      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate used by this Mutiny object of generated type
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • deliveryOptions

      public MessageProducer<T> deliveryOptions(io.vertx.core.eventbus.DeliveryOptions options)
      Parameters:
      options - the new options
      Returns:
      this producer object
    • address

      public String address()
      Returns:
      The address to which the producer produces messages.
    • write

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> write(T body)
      Write a message to the event-bus, either sending or publishing. The handler completion depends on the producer type:
      • send or request: the handler is completed successfully if the message has been written; otherwise, the handler is failed
      • publish: the handler is failed if there is no recipient; otherwise, the handler is completed successfully
      In any case, a successfully completed handler is not a delivery guarantee.

      Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

      Parameters:
      body - the message body
      Returns:
      the uni firing the result of the operation when completed, or a failure if the operation failed.
    • writeAndAwait

      public Void writeAndAwait(T body)
      Blocking variant of write(T).

      This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      body - the message body
      Returns:
      the Void instance produced by the operation.
    • writeAndForget

      public void writeAndForget(T body)
      Variant of write(T) that ignores the result of the operation.

      This method subscribes on the result of write(T), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from write(T) but you don't need to compose it with other operations.

      Parameters:
      body - the message body
    • close

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
      Same as close() but with an handler called when the operation completes

      Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

      Returns:
      the uni firing the result of the operation when completed, or a failure if the operation failed.
    • closeAndAwait

      public Void closeAndAwait()
      Blocking variant of close().

      This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Returns:
      the Void instance produced by the operation.
    • closeAndForget

      public void closeAndForget()
      Variant of close() that ignores the result of the operation.

      This method subscribes on the result of close(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from close() but you don't need to compose it with other operations.

    • newInstance

      public static <T> MessageProducer<T> newInstance(io.vertx.core.eventbus.MessageProducer arg)
    • newInstance

      public static <T> MessageProducer<T> newInstance(io.vertx.core.eventbus.MessageProducer arg, TypeArg<T> __typeArg_T)