Spring Integration

org.springframework.integration.mail
Class MailReceivingMessageSource

java.lang.Object
  extended by org.springframework.integration.mail.MailReceivingMessageSource
All Implemented Interfaces:
MessageSource<javax.mail.Message>, PseudoTransactionalMessageSource<javax.mail.Message,MailReceiver.MailReceiverContext>

public class MailReceivingMessageSource
extends java.lang.Object
implements PseudoTransactionalMessageSource<javax.mail.Message,MailReceiver.MailReceiverContext>

MessageSource implementation that delegates to a MailReceiver to poll a mailbox. Each poll of the mailbox may return more than one message which will then be stored in a queue.

Author:
Jonas Partner, Mark Fisher, Gary Russell

Constructor Summary
MailReceivingMessageSource(MailReceiver mailReceiver)
           
 
Method Summary
 void afterCommit(MailReceiver.MailReceiverContext context)
          Invoked via TransactionSynchronization when the transaction commits.
 void afterReceiveNoTx(MailReceiver.MailReceiverContext resource)
          For backwards-compatibility; the mail adapter updates the status before the send.
 void afterRollback(MailReceiver.MailReceiverContext context)
          Invoked via TransactionSynchronization when the transaction rolls back.
 void afterSendNoTx(MailReceiver.MailReceiverContext resource)
          For backwards-compatibility; the mail adapter updates the status before the send.
 MailReceiver.MailReceiverContext getResource()
          Obtain the resource on which appropriate action needs to be taken.
 Message<javax.mail.Message> receive()
          Retrieve the next available message from this source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailReceivingMessageSource

public MailReceivingMessageSource(MailReceiver mailReceiver)
Method Detail

receive

public Message<javax.mail.Message> receive()
Description copied from interface: MessageSource
Retrieve the next available message from this source. Returns null if no message is available.

Specified by:
receive in interface MessageSource<javax.mail.Message>

getResource

public MailReceiver.MailReceiverContext getResource()
Description copied from interface: PseudoTransactionalMessageSource
Obtain the resource on which appropriate action needs to be taken.

Specified by:
getResource in interface PseudoTransactionalMessageSource<javax.mail.Message,MailReceiver.MailReceiverContext>
Returns:
The resource.

afterCommit

public void afterCommit(MailReceiver.MailReceiverContext context)
Description copied from interface: PseudoTransactionalMessageSource
Invoked via TransactionSynchronization when the transaction commits.

Specified by:
afterCommit in interface PseudoTransactionalMessageSource<javax.mail.Message,MailReceiver.MailReceiverContext>
Parameters:
context - The resource to be "committed"

afterRollback

public void afterRollback(MailReceiver.MailReceiverContext context)
Description copied from interface: PseudoTransactionalMessageSource
Invoked via TransactionSynchronization when the transaction rolls back.

Specified by:
afterRollback in interface PseudoTransactionalMessageSource<javax.mail.Message,MailReceiver.MailReceiverContext>

afterReceiveNoTx

public void afterReceiveNoTx(MailReceiver.MailReceiverContext resource)
For backwards-compatibility; the mail adapter updates the status before the send.

Specified by:
afterReceiveNoTx in interface PseudoTransactionalMessageSource<javax.mail.Message,MailReceiver.MailReceiverContext>

afterSendNoTx

public void afterSendNoTx(MailReceiver.MailReceiverContext resource)
For backwards-compatibility; the mail adapter updates the status before the send.

Specified by:
afterSendNoTx in interface PseudoTransactionalMessageSource<javax.mail.Message,MailReceiver.MailReceiverContext>

Spring Integration