public interface Message<T>
Messages have a body()
, which can be null, and also headers()
, 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 fail(int, java.lang.String)
can be called.
Modifier and Type | Method and Description |
---|---|
String |
address()
The address the message was sent to
|
T |
body()
The body of the message.
|
void |
fail(int failureCode,
String message)
Signal to the sender that processing of this message failed.
|
MultiMap |
headers()
Multi-map of message headers.
|
boolean |
isSend()
Signals if this message represents a send or publish event.
|
void |
reply(Object message)
Reply to this message.
|
void |
reply(Object message,
DeliveryOptions options)
Link
reply(Object) but allows you to specify delivery options for the reply. |
<R> void |
reply(Object message,
DeliveryOptions options,
Handler<AsyncResult<Message<R>>> replyHandler)
Deprecated.
|
<R> void |
reply(Object message,
Handler<AsyncResult<Message<R>>> replyHandler)
Deprecated.
|
String |
replyAddress()
The reply address.
|
default <R> void |
replyAndRequest(Object message,
DeliveryOptions options,
Handler<AsyncResult<Message<R>>> replyHandler)
Like
replyAndRequest(Object, Handler) but specifying options that can be used
to configure the delivery. |
default <R> void |
replyAndRequest(Object message,
Handler<AsyncResult<Message<R>>> replyHandler)
Reply to this message, specifying a
replyHandler for the reply - i.e. |
String address()
MultiMap headers()
T body()
String replyAddress()
boolean isSend()
void reply(Object message)
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.
message
- the message to reply with.@Deprecated <R> void reply(Object message, Handler<AsyncResult<Message<R>>> replyHandler)
replyAndRequest(Object, Handler)
reply(R message)
but you can specify handler for the reply - i.e.
to receive the reply to the reply.message
- the message to reply with.replyHandler
- the reply handler for the reply.void reply(Object message, DeliveryOptions options)
reply(Object)
but allows you to specify delivery options for the reply.message
- the reply messageoptions
- the delivery options@Deprecated <R> void reply(Object message, DeliveryOptions options, Handler<AsyncResult<Message<R>>> replyHandler)
replyAndRequest(Object, DeliveryOptions, Handler)
reply(R message, DeliveryOptions)
but you can specify handler for the reply - i.e.
to receive the reply to the reply.message
- the reply messageoptions
- the delivery optionsreplyHandler
- the reply handler for the reply.default <R> void replyAndRequest(Object message, Handler<AsyncResult<Message<R>>> replyHandler)
replyHandler
for 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.
message
- the message to reply with.replyHandler
- the reply handler for the reply.default <R> void replyAndRequest(Object message, DeliveryOptions options, Handler<AsyncResult<Message<R>>> replyHandler)
replyAndRequest(Object, Handler)
but specifying options
that can be used
to configure the delivery.message
- the message body, may be null
options
- delivery optionsreplyHandler
- reply handler will be called when any reply from the recipient is receivedvoid fail(int failureCode, String message)
If the message was sent specifying a result handler the handler will be called with a failure corresponding to the failure code and message specified here.
failureCode
- A failure code to pass back to the sendermessage
- A message to pass back to the senderCopyright © 2023 Eclipse. All rights reserved.