org.springframework.integration.adapter.mail
Class SubscribableMailSource

java.lang.Object
  extended by org.springframework.integration.adapter.mail.SubscribableMailSource
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.context.Lifecycle, MessageSource, SubscribableSource

public class SubscribableMailSource
extends java.lang.Object
implements SubscribableSource, org.springframework.context.Lifecycle, org.springframework.beans.factory.DisposableBean

Broadcasts all mail messages recovered to subscribed MessageTargets. The given FolderConnection should be using an AsyncMonitoringStrategy to retrieve mail.

Author:
Jonas Partner

Nested Class Summary
private  class SubscribableMailSource.MonitorRunnable
           
 
Field Summary
private  MailMessageConverter converter
           
private  BroadcastingDispatcher dispatcher
           
private  org.apache.commons.logging.Log logger
           
private  SubscribableMailSource.MonitorRunnable monitorRunnable
           
private  boolean monitorRunning
           
private  org.springframework.core.task.TaskExecutor taskExecutor
           
 
Constructor Summary
SubscribableMailSource(FolderConnection folderConnection, org.springframework.core.task.TaskExecutor taskExecutor)
           
 
Method Summary
 void destroy()
           
 boolean isRunning()
           
 void setApplySequence(boolean applySequence)
           
 void setConverter(MailMessageConverter converter)
           
 void start()
           
protected  void startMonitor()
           
 void stop()
           
protected  void stopMonitor()
           
 boolean subscribe(MessageTarget target)
          Register a MessageTarget as a subscriber to this source.
 boolean unsubscribe(MessageTarget target)
          Remove a MessageTarget from the subscribers of this source.
 
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

dispatcher

private final BroadcastingDispatcher dispatcher

taskExecutor

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

monitorRunnable

private final SubscribableMailSource.MonitorRunnable monitorRunnable

monitorRunning

private volatile boolean monitorRunning

converter

private volatile MailMessageConverter converter
Constructor Detail

SubscribableMailSource

public SubscribableMailSource(FolderConnection folderConnection,
                              org.springframework.core.task.TaskExecutor taskExecutor)
Method Detail

setApplySequence

public void setApplySequence(boolean applySequence)

subscribe

public boolean subscribe(MessageTarget target)
Description copied from interface: SubscribableSource
Register a MessageTarget as a subscriber to this source.

Specified by:
subscribe in interface SubscribableSource

unsubscribe

public boolean unsubscribe(MessageTarget target)
Description copied from interface: SubscribableSource
Remove a MessageTarget from the subscribers of this source.

Specified by:
unsubscribe in interface SubscribableSource

setConverter

public void setConverter(MailMessageConverter converter)

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception

start

public void start()
Specified by:
start in interface org.springframework.context.Lifecycle

stop

public void stop()
Specified by:
stop in interface org.springframework.context.Lifecycle

isRunning

public boolean isRunning()
Specified by:
isRunning in interface org.springframework.context.Lifecycle

startMonitor

protected void startMonitor()

stopMonitor

protected void stopMonitor()