org.springframework.integration.adapter
Class MessageHandlingSourceAdapter

java.lang.Object
  extended by org.springframework.integration.adapter.MessageHandlingSourceAdapter
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, MessageHandler
Direct Known Subclasses:
HttpInvokerSourceAdapter, RmiSourceAdapter

public class MessageHandlingSourceAdapter
extends java.lang.Object
implements MessageHandler, org.springframework.beans.factory.InitializingBean

A source adapter that implements the MessageHandler interface. It may be used as a base class for source adapters with request-reply behavior.

Author:
Mark Fisher

Field Summary
private  boolean expectReply
           
private  boolean initialized
           
protected  java.lang.Object lifecycleMonitor
           
private  org.apache.commons.logging.Log logger
           
private  MessageChannel requestChannel
           
private  RequestReplyTemplate requestReplyTemplate
           
 
Constructor Summary
MessageHandlingSourceAdapter(MessageChannel requestChannel)
          Create an adapter that sends to the provided channel.
 
Method Summary
 void afterPropertiesSet()
           
protected  MessageChannel getChannel()
           
 Message<?> handle(Message<?> message)
           
protected  void initialize()
          Subclasses may override this method for initialization.
 void setExpectReply(boolean expectReply)
          Specify whether the handle method should be expected to return a reply.
 void setReplyTimeout(long replyTimeout)
           
 void setRequestTimeout(long requestTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private final org.apache.commons.logging.Log logger

requestChannel

private final MessageChannel requestChannel

requestReplyTemplate

private final RequestReplyTemplate requestReplyTemplate

expectReply

private volatile boolean expectReply

lifecycleMonitor

protected final java.lang.Object lifecycleMonitor

initialized

private volatile boolean initialized
Constructor Detail

MessageHandlingSourceAdapter

public MessageHandlingSourceAdapter(MessageChannel requestChannel)
Create an adapter that sends to the provided channel.

Parameters:
requestChannel - the channel where messages will be sent, must not be null.
Method Detail

setExpectReply

public void setExpectReply(boolean expectReply)
Specify whether the handle method should be expected to return a reply. The default is 'true'.


setRequestTimeout

public void setRequestTimeout(long requestTimeout)

setReplyTimeout

public void setReplyTimeout(long replyTimeout)

getChannel

protected MessageChannel getChannel()

afterPropertiesSet

public final void afterPropertiesSet()
                              throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

initialize

protected void initialize()
                   throws java.lang.Exception
Subclasses may override this method for initialization.

Throws:
java.lang.Exception

handle

public final Message<?> handle(Message<?> message)
Specified by:
handle in interface MessageHandler