org.springframework.integration.channel
Class MessageChannelTemplate

java.lang.Object
  extended by org.springframework.integration.channel.MessageChannelTemplate
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

public class MessageChannelTemplate
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean

This is the central class for invoking message exchange operations across MessageChannels. It supports one-way send and receive calls as well as request/reply.

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

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
MessageChannelTemplate()
          Create a MessageChannelTemplate with no default channel.
MessageChannelTemplate(MessageChannel defaultChannel)
          Create a MessageChannelTemplate with the given default channel.
 
Method Summary
 void afterPropertiesSet()
           
 Message<?> receive()
           
 Message<?> receive(PollableChannel channel)
           
 boolean send(Message<?> message)
           
 boolean send(Message<?> message, MessageChannel channel)
           
 Message<?> sendAndReceive(Message<?> request)
           
 Message<?> sendAndReceive(Message<?> request, MessageChannel channel)
           
 void setDefaultChannel(MessageChannel defaultChannel)
          Specify the default MessageChannel to use when invoking the send and/or receive methods that do not expect a channel parameter.
 void setIsolationLevelName(java.lang.String isolationLevelName)
           
 void setPropagationBehaviorName(java.lang.String propagationBehaviorName)
           
 void setReceiveTimeout(long receiveTimeout)
          Specify the timeout value to use for receive operations.
 void setSendTimeout(long sendTimeout)
          Specify the timeout value to use for send operations.
 void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
          Specify a transaction manager to use for all exchange operations.
 void setTransactionReadOnly(boolean readOnly)
           
 void setTransactionTimeout(int transactionTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

MessageChannelTemplate

public MessageChannelTemplate()
Create a MessageChannelTemplate with no default channel. Note, that one may be provided by invoking setDefaultChannel(MessageChannel).


MessageChannelTemplate

public MessageChannelTemplate(MessageChannel defaultChannel)
Create a MessageChannelTemplate with the given default channel.

Method Detail

setDefaultChannel

public void setDefaultChannel(MessageChannel defaultChannel)
Specify the default MessageChannel to use when invoking the send and/or receive methods that do not expect a channel parameter.


setSendTimeout

public void setSendTimeout(long sendTimeout)
Specify the timeout value to use for send operations.

Parameters:
sendTimeout - the send timeout in milliseconds

setReceiveTimeout

public void setReceiveTimeout(long receiveTimeout)
Specify the timeout value to use for receive operations.

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)

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

send

public boolean send(Message<?> message)

send

public boolean send(Message<?> message,
                    MessageChannel channel)

receive

public Message<?> receive()

receive

public Message<?> receive(PollableChannel channel)

sendAndReceive

public Message<?> sendAndReceive(Message<?> request)

sendAndReceive

public Message<?> sendAndReceive(Message<?> request,
                                 MessageChannel channel)