org.springframework.integration.message
Class AsyncMessageExchangeTemplate

java.lang.Object
  extended by org.springframework.integration.message.MessageExchangeTemplate
      extended by org.springframework.integration.message.AsyncMessageExchangeTemplate
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

public class AsyncMessageExchangeTemplate
extends MessageExchangeTemplate

An asynchronous version of the MessageExchangeTemplate.

Author:
Mark Fisher

Field Summary
private  org.springframework.core.task.TaskExecutor taskExecutor
           
 
Fields inherited from class org.springframework.integration.message.MessageExchangeTemplate
logger
 
Constructor Summary
AsyncMessageExchangeTemplate(org.springframework.core.task.TaskExecutor taskExecutor)
           
 
Method Summary
 Message<?> receive(PollableSource<?> source)
          Receive an AsyncMessage from the provided source.
 boolean receiveAndForward(PollableSource<?> source, MessageTarget target)
          Receive a Message from the provided source and if not null, send it to the given target.
 boolean send(Message<?> message, MessageTarget target)
          Send the provided message to the given target.
 Message<?> sendAndReceive(Message<?> request, MessageTarget target)
          Send the provided message to the given target and receive the result as an AsyncMessage.
 
Methods inherited from class org.springframework.integration.message.MessageExchangeTemplate
afterPropertiesSet, setIsolationLevelName, setPropagationBehaviorName, setReceiveTimeout, setSendTimeout, setTransactionManager, setTransactionReadOnly, setTransactionTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

taskExecutor

private final org.springframework.core.task.TaskExecutor taskExecutor
Constructor Detail

AsyncMessageExchangeTemplate

public AsyncMessageExchangeTemplate(org.springframework.core.task.TaskExecutor taskExecutor)
Method Detail

send

public boolean send(Message<?> message,
                    MessageTarget target)
Send the provided message to the given target. Note that the actual sending occurs asynchronously, so this method will always return true unless an exception is thrown by the executor.

Overrides:
send in class MessageExchangeTemplate

sendAndReceive

public Message<?> sendAndReceive(Message<?> request,
                                 MessageTarget target)
Send the provided message to the given target and receive the result as an AsyncMessage.

Overrides:
sendAndReceive in class MessageExchangeTemplate

receive

public Message<?> receive(PollableSource<?> source)
Receive an AsyncMessage from the provided source.

Overrides:
receive in class MessageExchangeTemplate

receiveAndForward

public boolean receiveAndForward(PollableSource<?> source,
                                 MessageTarget target)
Receive a Message from the provided source and if not null, send it to the given target. Note that the receive and send operations occur asynchronously, so this method will always return true unless an exception is thrown by the executor.

Overrides:
receiveAndForward in class MessageExchangeTemplate