Package org.springframework.messaging
Interface MessageChannel
- All Known Subinterfaces:
PollableChannel
,SubscribableChannel
- All Known Implementing Classes:
AbstractMessageChannel
,AbstractSubscribableChannel
,ExecutorSubscribableChannel
,OrderedMessageChannelDecorator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Defines methods for sending messages.
- Since:
- 4.0
- Author:
- Mark Fisher
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
Constant for sending a message without a prescribed timeout. -
Method Summary
-
Field Details
-
INDEFINITE_TIMEOUT
static final long INDEFINITE_TIMEOUTConstant for sending a message without a prescribed timeout.- See Also:
-
-
Method Details
-
send
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)
.- Parameters:
message
- the message to send- Returns:
- whether or not the message was sent
-
send
Send a message, blocking until either the message is accepted or the specified timeout period elapses.- Parameters:
message
- the message to sendtimeout
- the timeout in milliseconds orINDEFINITE_TIMEOUT
- Returns:
true
if the message is sent,false
if not including a timeout of an interrupt of the send
-