接口 MessageChannel
- 所有已知子接口:
PollableChannel
,SubscribableChannel
public interface MessageChannel
Defines methods for sending messages.- 从以下版本开始:
- 4.0
- 作者:
- Mark Fisher
字段概要
字段 修饰符和类型 字段 说明 static long
INDEFINITE_TIMEOUT
Constant for sending a message without a prescribed timeout.
字段详细资料
INDEFINITE_TIMEOUT
static final long INDEFINITE_TIMEOUT
Constant for sending a message without a prescribed timeout.- 另请参阅:
- 常量字段值
方法详细资料
send
boolean send(Message<?> message)
Send aMessage
to this channel. If the message is sent successfully, the method returnstrue
. If the message cannot be sent due to a non-fatal reason, the method returnsfalse
. 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 send- 返回:
- whether or not the message was sent
send
boolean send(Message<?> message, long timeout)
Send a message, blocking until either the message is accepted or the specified timeout period elapses.- 参数:
message
- the message to sendtimeout
- the timeout in milliseconds orINDEFINITE_TIMEOUT
- 返回:
true
if the message is sent,false
if not including a timeout of an interrupt of the send