MessageChannel (Spring Framework 5.0.0.RELEASE API) (original) (raw)
- All Known Subinterfaces:
PollableChannel, SubscribableChannel
All Known Implementing Classes:
AbstractMessageChannel, AbstractSubscribableChannel, ExecutorSubscribableChannel
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface MessageChannel
Defines methods for sending messages.
Since:
4.0
Author:
Mark Fisher
Field Summary
Fields
Modifier and Type Field and Description static long INDEFINITE_TIMEOUT Constant for sending a message without a prescribed timeout. Method Summary
All Methods Instance Methods Abstract Methods Default Methods
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. Field Detail
* #### INDEFINITE\_TIMEOUT static final long INDEFINITE_TIMEOUT Constant for sending a message without a prescribed timeout. See Also: [Constant Field Values](../../../constant-values.html#org.springframework.messaging.MessageChannel.INDEFINITE%5FTIMEOUT)
Method Detail
* #### send default boolean send([Message](../../../org/springframework/messaging/Message.html "interface in org.springframework.messaging")<?> message) Send a [Message](../../../org/springframework/messaging/Message.html "interface in org.springframework.messaging") 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)](../../../org/springframework/messaging/MessageChannel.html#send-org.springframework.messaging.Message-long-). Parameters: `message` \- the message to send Returns: whether or not the message was sent * #### send boolean send([Message](../../../org/springframework/messaging/Message.html "interface in org.springframework.messaging")<?> message, long timeout) Send a message, blocking until either the message is accepted or the specified timeout period elapses. Parameters: `message` \- the message to send `timeout` \- the timeout in milliseconds or [INDEFINITE\_TIMEOUT](../../../org/springframework/messaging/MessageChannel.html#INDEFINITE%5FTIMEOUT) Returns: `true` if the message is sent, `false` if not including a timeout of an interrupt of the send