org.springframework.integration.message
Class MessageExchangeTemplate
java.lang.Object
org.springframework.integration.message.MessageExchangeTemplate
- All Implemented Interfaces:
- org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
- AsyncMessageExchangeTemplate
public class MessageExchangeTemplate
- extends java.lang.Object
- implements org.springframework.beans.factory.InitializingBean
This is the central class for invoking message exchange operations
across PollableSource
s and MessageTarget
s. It supports
one-way send and receive calls as well as request/reply. Additionally,
the receiveAndForward(PollableSource, MessageTarget)
method
plays the role of a polling-consumer while actually sending any
received message to an event-driven consumer.
To enable transactions, configure the 'transactionManager' property
with a reference to an instance of Spring's PlatformTransactionManager
strategy and optionally provide the other transactional attributes
(e.g. 'propagationBehaviorName').
- Author:
- Mark Fisher
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final org.apache.commons.logging.Log logger
sendTimeout
private volatile long sendTimeout
receiveTimeout
private volatile long receiveTimeout
transactionManager
private volatile org.springframework.transaction.PlatformTransactionManager transactionManager
transactionTemplate
private volatile org.springframework.transaction.support.TransactionTemplate transactionTemplate
propagationBehaviorName
private volatile java.lang.String propagationBehaviorName
isolationLevelName
private volatile java.lang.String isolationLevelName
transactionTimeout
private volatile int transactionTimeout
readOnly
private volatile boolean readOnly
initialized
private volatile boolean initialized
initializationMonitor
private final java.lang.Object initializationMonitor
MessageExchangeTemplate
public MessageExchangeTemplate()
setSendTimeout
public void setSendTimeout(long sendTimeout)
- Specify the timeout value to use for send operations.
Note that this value will only apply to
BlockingTarget
s.
- Parameters:
sendTimeout
- the send timeout in milliseconds
setReceiveTimeout
public void setReceiveTimeout(long receiveTimeout)
- Specify the timeout value to use for receive operations.
Note that this value will only apply to
BlockingSource
s.
- Parameters:
receiveTimeout
- the receive timeout in milliseconds
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
- Specify a transaction manager to use for all exchange operations.
If none is provided, then the operations will occur without any
transactional behavior (i.e. there is no default transaction manager).
setPropagationBehaviorName
public void setPropagationBehaviorName(java.lang.String propagationBehaviorName)
setIsolationLevelName
public void setIsolationLevelName(java.lang.String isolationLevelName)
setTransactionTimeout
public void setTransactionTimeout(int transactionTimeout)
setTransactionReadOnly
public void setTransactionReadOnly(boolean readOnly)
getTransactionTemplate
private org.springframework.transaction.support.TransactionTemplate getTransactionTemplate()
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
send
public boolean send(Message<?> message,
MessageTarget target)
sendAndReceive
public Message<?> sendAndReceive(Message<?> request,
MessageTarget target)
receive
public Message<?> receive(PollableSource<?> source)
receiveAndForward
public boolean receiveAndForward(PollableSource<?> source,
MessageTarget target)
doSend
private boolean doSend(Message<?> message,
MessageTarget target)
doReceive
private Message<?> doReceive(PollableSource<?> source)
doSendAndReceive
private Message<?> doSendAndReceive(Message<?> request,
MessageTarget target)
doReceiveAndForward
private boolean doReceiveAndForward(PollableSource<?> source,
MessageTarget target)