org.springframework.integration.message
Class MessageExchangeTemplate.TemporaryReturnAddress
java.lang.Object
org.springframework.integration.message.MessageExchangeTemplate.TemporaryReturnAddress
- All Implemented Interfaces:
- BlockingSource, MessageSource, MessageTarget, PollableSource
- Enclosing class:
- MessageExchangeTemplate
private static class MessageExchangeTemplate.TemporaryReturnAddress
- extends java.lang.Object
- implements BlockingSource, MessageTarget
Method Summary |
Message |
receive()
Receive a message, blocking indefinitely if necessary. |
Message |
receive(long timeout)
Receive a message, blocking until either a message is available or the
specified timeout period elapses. |
boolean |
send(Message<?> message)
Send a Message to this target. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
message
private volatile Message<?> message
receiveTimeout
private final long receiveTimeout
latch
private final java.util.concurrent.CountDownLatch latch
MessageExchangeTemplate.TemporaryReturnAddress
public MessageExchangeTemplate.TemporaryReturnAddress(long receiveTimeout)
receive
public Message receive()
- Description copied from interface:
BlockingSource
- Receive a message, blocking indefinitely if necessary.
- Specified by:
receive
in interface BlockingSource
- Specified by:
receive
in interface PollableSource
- Returns:
- the next available
Message
or null
if
interrupted
receive
public Message receive(long timeout)
- Description copied from interface:
BlockingSource
- Receive a message, blocking until either a message is available or the
specified timeout period elapses.
- Specified by:
receive
in interface BlockingSource
- Parameters:
timeout
- the timeout in milliseconds
- Returns:
- the next available
Message
or null
if the
specified timeout period elapses or the message reception is interrupted
send
public boolean send(Message<?> message)
- Description copied from interface:
MessageTarget
- Send a
Message
to this target. May throw a RuntimeException for non-recoverable
errors. Otherwise, if the Message cannot be sent for a non-fatal reason such as timeout,
then this method will return 'false', and if the Message is sent successfully, it will
return 'true'.
- Specified by:
send
in interface MessageTarget
- Parameters:
message
- the Message to send
- Returns:
- whether the Message has been sent successfully