public class MailMessageReceiver extends AbstractAsyncStandaloneMessageReceiver
transport
URI, store
URI, and monitoringStrategy
to be set, in addition to the messageFactory
and messageReceiver
required by the base class.
The MonitoringStrategy
is used to detect new incoming email request. If the monitoringStrategy
is not explicitly set, this receiver will use the Pop3PollingMonitoringStrategy
for POP3 servers, and the
PollingMonitoringStrategy
for IMAP servers.
DEFAULT_THREAD_NAME_PREFIX
logger
Constructor and Description |
---|
MailMessageReceiver() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Calls
AbstractStandaloneMessageReceiver.activate() when the BeanFactory initializes the receiver instance. |
protected void |
onActivate()
Template method invoked when
AbstractStandaloneMessageReceiver.activate() is invoked. |
protected void |
onShutdown()
Template method invoked when
AbstractStandaloneMessageReceiver.shutdown() is invoked. |
protected void |
onStart()
Template method invoked when
AbstractStandaloneMessageReceiver.start() is invoked. |
protected void |
onStop()
Template method invoked when
AbstractStandaloneMessageReceiver.stop() is invoked. |
void |
setFrom(String from)
Sets the from address to use when sending response messages.
|
void |
setJavaMailProperties(Properties javaMailProperties)
Set JavaMail properties for the
Session . |
void |
setMonitoringStrategy(MonitoringStrategy monitoringStrategy)
Sets the monitoring strategy to use for retrieving new requests.
|
void |
setSession(javax.mail.Session session)
Set the JavaMail
Session , possibly pulled from JNDI. |
void |
setStoreUri(String storeUri)
Sets the JavaMail Store URI to be used for retrieving request messages.
|
void |
setTransportUri(String transportUri)
Sets the JavaMail Transport URI to be used for sending response messages.
|
createDefaultTaskExecutor, execute, setBeanName, setTaskExecutor
activate, destroy, isActive, isRunning, setAutoStartup, shutdown, start, stop
getMessageReceiver, handleConnection, setMessageReceiver
getMessageFactory, handleConnection, handleNoEndpointFoundException, setMessageFactory
public void setFrom(String from) throws javax.mail.internet.AddressException
javax.mail.internet.AddressException
public void setJavaMailProperties(Properties javaMailProperties)
Session
.
A new Session
will be created with those properties. Use either this method or setSession(javax.mail.Session)
, but
not both.
Non-default properties in this instance will override given JavaMail properties.
public void setSession(javax.mail.Session session)
Session
, possibly pulled from JNDI.
Default is a new Session
without defaults, that is completely configured via this instance's
properties.
If using a pre-configured Session
, non-default properties in this instance will override the
settings in the Session
.
public void setStoreUri(String storeUri)
[imap|pop3]://user:password@host:port/INBOX
. Setting this property is required.
For example, imap://john:[email protected]/INBOX
Session.getStore(URLName)
public void setTransportUri(String transportUri)
smtp://user:password@host:port
. Setting this property is required.
For example, smtp://john:[email protected]
Session.getTransport(URLName)
public void setMonitoringStrategy(MonitoringStrategy monitoringStrategy)
PollingMonitoringStrategy
.public void afterPropertiesSet() throws Exception
AbstractStandaloneMessageReceiver
AbstractStandaloneMessageReceiver.activate()
when the BeanFactory initializes the receiver instance.afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class AbstractAsyncStandaloneMessageReceiver
Exception
protected void onActivate() throws javax.mail.MessagingException
AbstractStandaloneMessageReceiver
AbstractStandaloneMessageReceiver.activate()
is invoked.onActivate
in class AbstractStandaloneMessageReceiver
javax.mail.MessagingException
protected void onStart()
AbstractStandaloneMessageReceiver
AbstractStandaloneMessageReceiver.start()
is invoked.onStart
in class AbstractStandaloneMessageReceiver
protected void onStop()
AbstractStandaloneMessageReceiver
AbstractStandaloneMessageReceiver.stop()
is invoked.onStop
in class AbstractStandaloneMessageReceiver
protected void onShutdown()
AbstractStandaloneMessageReceiver
AbstractStandaloneMessageReceiver.shutdown()
is invoked.onShutdown
in class AbstractStandaloneMessageReceiver
Copyright © 2020 Pivotal Software. All rights reserved.