Class MessageProducer<T>
- java.lang.Object
-
- io.vertx.mutiny.core.eventbus.MessageProducer<T>
-
public class MessageProducer<T> extends Object
Represents a stream of message that can be written to.original
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<MessageProducer>
__TYPE_ARG
TypeArg<T>
__typeArg_0
-
Constructor Summary
Constructors Constructor Description MessageProducer(io.vertx.core.eventbus.MessageProducer delegate)
MessageProducer(io.vertx.core.eventbus.MessageProducer delegate, TypeArg<T> typeArg_0)
MessageProducer(Object delegate, TypeArg<T> typeArg_0)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
address()
io.smallrye.mutiny.Uni<Void>
close()
Same asclose()
but with anhandler
called when the operation completesVoid
closeAndAwait()
Blocking variant ofclose()
.void
closeAndForget()
Variant ofclose()
that ignores the result of the operation.MessageProducer<T>
deliveryOptions(io.vertx.core.eventbus.DeliveryOptions options)
boolean
equals(Object o)
io.vertx.core.eventbus.MessageProducer
getDelegate()
int
hashCode()
static <T> MessageProducer<T>
newInstance(io.vertx.core.eventbus.MessageProducer arg)
static <T> MessageProducer<T>
newInstance(io.vertx.core.eventbus.MessageProducer arg, TypeArg<T> __typeArg_T)
String
toString()
io.smallrye.mutiny.Uni<Void>
write(T body)
Write a message to the event-bus, either sending or publishing.Void
writeAndAwait(T body)
Blocking variant ofio.vertx.mutiny.core.eventbus.MessageProducer#write(T)
.void
writeAndForget(T body)
Variant ofio.vertx.mutiny.core.eventbus.MessageProducer#write(T)
that ignores the result of the operation.
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<MessageProducer> __TYPE_ARG
-
-
Method Detail
-
getDelegate
public io.vertx.core.eventbus.MessageProducer getDelegate()
-
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. Thehandler
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
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 ofio.vertx.mutiny.core.eventbus.MessageProducer#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 ofio.vertx.mutiny.core.eventbus.MessageProducer#write(T)
that ignores the result of the operation.This method subscribes on the result of
io.vertx.mutiny.core.eventbus.MessageProducer#write(T)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromio.vertx.mutiny.core.eventbus.MessageProducer#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 asclose()
but with anhandler
called when the operation completesUnlike 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 ofclose()
.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()
-
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)
-
-