Class Message<T>
- java.lang.Object
-
- io.vertx.mutiny.core.eventbus.Message<T>
-
public class Message<T> extends Object
Represents a message that is received from the event bus in a handler.Messages have a
body(), which can be null, and alsoheaders(), which can be empty.If the message was sent specifying a reply handler, it can be replied to using
reply(java.lang.Object).If you want to notify the sender that processing failed, then
NOTE: This class has been automatically generated from thefail(int, java.lang.String)can be called.originalnon Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<Message>__TYPE_ARGTypeArg<T>__typeArg_0
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Stringaddress()Tbody()booleanequals(Object o)voidfail(int failureCode, String message)io.vertx.core.eventbus.MessagegetDelegate()inthashCode()MultiMapheaders()booleanisSend()static <T> Message<T>newInstance(io.vertx.core.eventbus.Message arg)static <T> Message<T>newInstance(io.vertx.core.eventbus.Message arg, TypeArg<T> __typeArg_T)<R> io.smallrye.mutiny.Uni<Message<R>>reply(Object message)Deprecated.<R> io.smallrye.mutiny.Uni<Message<R>>reply(Object message, io.vertx.core.eventbus.DeliveryOptions options)Deprecated.StringreplyAddress()<R> Message<R>replyAndAwait(Object message)Deprecated.<R> Message<R>replyAndAwait(Object message, io.vertx.core.eventbus.DeliveryOptions options)Deprecated.voidreplyAndForget(Object message)Variant ofreply(Object)that ignores the result of the operation.voidreplyAndForget(Object message, io.vertx.core.eventbus.DeliveryOptions options)Variant ofreply(Object,DeliveryOptions)that ignores the result of the operation.<R> io.smallrye.mutiny.Uni<Message<R>>replyAndRequest(Object message)Reply to this message, specifying areplyHandlerfor the reply - i.e.<R> io.smallrye.mutiny.Uni<Message<R>>replyAndRequest(Object message, io.vertx.core.eventbus.DeliveryOptions options)LikereplyAndRequest(java.lang.Object)but specifyingoptionsthat can be used to configure the delivery.<R> Message<R>replyAndRequestAndAwait(Object message)Blocking variant ofreplyAndRequest(Object).<R> Message<R>replyAndRequestAndAwait(Object message, io.vertx.core.eventbus.DeliveryOptions options)Blocking variant ofreplyAndRequest(Object,DeliveryOptions).StringtoString()
-
-
-
Method Detail
-
getDelegate
public io.vertx.core.eventbus.Message getDelegate()
-
address
public String address()
- Returns:
-
headers
public MultiMap headers()
- Returns:
- the headers
-
body
public T body()
- Returns:
- the body, or null.
-
replyAddress
public String replyAddress()
- Returns:
- the reply address, or null, if message was sent without a reply handler.
-
isSend
public boolean isSend()
- Returns:
- true if this is a send.
-
reply
@Deprecated public <R> io.smallrye.mutiny.Uni<Message<R>> reply(Object message)
Deprecated.The same asreply(R message)but you can specify handler for the reply - i.e. to receive the reply to the reply.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
message- the message to reply with.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
replyAndAwait
@Deprecated public <R> Message<R> replyAndAwait(Object message)
Deprecated.Blocking variant ofreply(Object).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:
message- the message to reply with.- Returns:
- the Message
instance produced by the operation
-
reply
@Deprecated public <R> io.smallrye.mutiny.Uni<Message<R>> reply(Object message, io.vertx.core.eventbus.DeliveryOptions options)
Deprecated.The same asreply(R message, DeliveryOptions)but you can specify handler for the reply - i.e. to receive the reply to the reply.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
message- the reply messageoptions- the delivery options- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
replyAndAwait
@Deprecated public <R> Message<R> replyAndAwait(Object message, io.vertx.core.eventbus.DeliveryOptions options)
Deprecated.Blocking variant ofreply(Object,DeliveryOptions).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:
message- the reply messageoptions- the delivery options- Returns:
- the Message
instance produced by the operation
-
replyAndRequest
public <R> io.smallrye.mutiny.Uni<Message<R>> replyAndRequest(Object message)
Reply to this message, specifying areplyHandlerfor the reply - i.e. to receive the reply to the reply.If the message was sent specifying a reply handler, that handler will be called when it has received a reply. If the message wasn't sent specifying a receipt handler this method does nothing.
Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
message- the message to reply with.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
replyAndRequestAndAwait
public <R> Message<R> replyAndRequestAndAwait(Object message)
Blocking variant ofreplyAndRequest(Object).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:
message- the message to reply with.- Returns:
- the Message
instance produced by the operation
-
replyAndRequest
public <R> io.smallrye.mutiny.Uni<Message<R>> replyAndRequest(Object message, io.vertx.core.eventbus.DeliveryOptions options)
LikereplyAndRequest(java.lang.Object)but specifyingoptionsthat can be used to configure the delivery.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
message- the message body, may benulloptions- delivery options- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
replyAndRequestAndAwait
public <R> Message<R> replyAndRequestAndAwait(Object message, io.vertx.core.eventbus.DeliveryOptions options)
Blocking variant ofreplyAndRequest(Object,DeliveryOptions).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:
message- the message body, may benulloptions- delivery options- Returns:
- the Message
instance produced by the operation
-
fail
public void fail(int failureCode, String message)- Parameters:
failureCode- A failure code to pass back to the sendermessage- A message to pass back to the sender
-
replyAndForget
public void replyAndForget(Object message)
Variant ofreply(Object)that ignores the result of the operation.This method subscribes on the result of
reply(Object), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromreply(Object)but you don't need to compose it with other operations.- Parameters:
message- the message to reply with.
-
replyAndForget
public void replyAndForget(Object message, io.vertx.core.eventbus.DeliveryOptions options)
Variant ofreply(Object,DeliveryOptions)that ignores the result of the operation.This method subscribes on the result of
reply(Object,DeliveryOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromreply(Object,DeliveryOptions)but you don't need to compose it with other operations.- Parameters:
message- the reply messageoptions- the delivery options
-
newInstance
public static <T> Message<T> newInstance(io.vertx.core.eventbus.Message arg)
-
-