public interface MessageChannel
Modifier and Type | Field and Description |
---|---|
static long |
INDEFINITE_TIMEOUT
Constant for sending a message without a prescribed timeout.
|
Modifier and Type | Method and Description |
---|---|
boolean |
send(Message<?> message)
Send a
Message to this channel. |
boolean |
send(Message<?> message,
long timeout)
Send a message, blocking until either the message is accepted or the specified
timeout period elapses.
|
static final long INDEFINITE_TIMEOUT
boolean send(Message<?> message)
Message
to this channel. May throw a RuntimeException for
non-recoverable errors. Otherwise, if the Message cannot be sent for a non-fatal
reason this method will return 'false', and if the Message is sent successfully, it
will return 'true'.
Depending on the implementation, this method may block indefinitely. To provide a
maximum wait time, use send(Message, long)
.
message
- the Message
to sendboolean send(Message<?> message, long timeout)
message
- the Message
to sendtimeout
- the timeout in milliseconds or #INDEFINITE_TIMEOUTtrue
if the message is sent successfully, false
if the
specified timeout period elapses or the send is interrupted