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.

Author:
Julien Viet
See Also:
  • MessageProducer
  • Field Details

  • Constructor Details

    • MessageProducer

      public MessageProducer(io.vertx.core.eventbus.MessageProducer<T> delegate)
      Create a new instance of MessageProducer delegating to the given (non-null) instance of MessageProducer.
    • MessageProducer

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

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

    • getDelegate

      public io.vertx.core.eventbus.MessageProducer<T> getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • write

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

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      body - the message body
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • io.vertx.core.eventbus.MessageProducer#write(T)
    • writeAndAwait

      public void writeAndAwait(T body)
      Write a message to the event-bus, either sending or publishing. The returned Future completion depends on the producer type:
      • send or request: the underlying uni is completed successfully if the message has been written; otherwise, the underlying uni is failed
      • publish: the underlying uni is failed if there is no recipient; otherwise, the underlying uni is completed successfully
      In any case, a successfully completed Future is not a delivery guarantee.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely 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
      See Also:
      • io.vertx.core.eventbus.MessageProducer#write(T)
    • writeAndForget

      public MessageProducer<T> writeAndForget(T body)
      Write a message to the event-bus, either sending or publishing. The returned Future completion depends on the producer type:
      • send or request: the underlying uni is completed successfully if the message has been written; otherwise, the underlying uni is failed
      • publish: the underlying uni is failed if there is no recipient; otherwise, the underlying uni is completed successfully
      In any case, a successfully completed Future is not a delivery guarantee.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Parameters:
      body - the message body
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • io.vertx.core.eventbus.MessageProducer#write(T)
    • close

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
      Closes the producer, this method should be called when the message producer is not used anymore.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MessageProducer.close()
    • closeAndAwait

      public void closeAndAwait()
      Closes the producer, this method should be called when the message producer is not used anymore.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely 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).

      See Also:
      • MessageProducer.close()
    • closeAndForget

      public MessageProducer<T> closeAndForget()
      Closes the producer, this method should be called when the message producer is not used anymore.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MessageProducer.close()
    • deliveryOptions

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

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

      public static <T> MessageProducer<T> newInstance(io.vertx.core.eventbus.MessageProducer<T> delegate)
      Creates a new instance of the MessageProducer.
    • newInstance

      public static <T> MessageProducer<T> newInstance(io.vertx.core.eventbus.MessageProducer<T> delegate, TypeArg<T> typeArg_0)
      Creates a new instance of the MessageProducer.
    • hashCode

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

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

      public String toString()
      Overrides:
      toString in class Object