Top Description Fields Methods
org.springframework.messaging

public Interface MessageChannel

Known Direct Subinterfaces
org.springframework.messaging.PollableChannel, org.springframework.messaging.SubscribableChannel
Known Direct Implementers
org.springframework.messaging.simp.broker.OrderedMessageChannelDecorator, org.springframework.messaging.support.AbstractMessageChannel
Annotations
@FunctionalInterface

Defines methods for sending messages.
Author
Mark Fisher
Since
4.0

Field Summary

Modifier and TypeField and Description
public static final long
INDEFINITE_TIMEOUT

Constant for sending a message without a prescribed timeout.

Method Summary

Modifier and TypeMethod and Description
public default boolean

Returns:

whether the message was sent
send
(Message<?>
the message to send
message
)

Send a Message to this channel.

public boolean

Returns:

true if the message is sent, false if not including a timeout of an interrupt of the send
send
(Message<?>
the message to send
message
,
long
the timeout in milliseconds or INDEFINITE_TIMEOUT
timeout
)

Send a message, blocking until either the message is accepted or the specified timeout period elapses.

Field Detail

INDEFINITE_TIMEOUTback to summary
public static final long INDEFINITE_TIMEOUT

Constant for sending a message without a prescribed timeout.

Method Detail

sendback to summary
public default boolean send(Message<?> message)

Send a 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).

Parameters
message:Message<?>

the message to send

Returns:boolean

whether the message was sent

sendback to summary
public boolean send(Message<?> message, long timeout)

Send a message, blocking until either the message is accepted or the specified timeout period elapses.

Parameters
message:Message<?>

the message to send

timeout:long

the timeout in milliseconds or INDEFINITE_TIMEOUT

Returns:boolean

true if the message is sent, false if not including a timeout of an interrupt of the send