@FunctionalInterface
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 |
---|---|
default 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
default boolean send(Message<?> message)
Message
to this channel. If the message is sent successfully,
the method returns true
. If the message cannot be sent due to a
non-fatal reason, the method returns false
. The method may also
throw a RuntimeException in case of non-recoverable errors.
This method may block indefinitely, depending on the implementation.
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_TIMEOUT
true
if the message is sent, false
if not
including a timeout of an interrupt of the send