public class MailPollerEndpoint extends PollingEndpoint implements MailEndpointType
definition, description, endpoint, interfaceName, service, serviceUnit| Constructor and Description |
|---|
MailPollerEndpoint()
default constructor
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getConnection() |
java.util.Map<java.lang.String,java.lang.String> |
getCustomProperties() |
java.lang.String |
getCustomTrustManagers() |
java.lang.String |
getLocationURI() |
AbstractMailMarshaler |
getMarshaler() |
int |
getMaxFetchSize() |
org.apache.servicemix.store.Store |
getStorage() |
boolean |
isDebugMode() |
boolean |
isDeleteProcessedMessages() |
boolean |
isProcessOnlyUnseenMessages() |
void |
poll() |
void |
process(javax.jbi.messaging.MessageExchange exchange) |
void |
setConnection(java.lang.String connection)
Specifies the connection URI used to connect to a mail server.
|
void |
setCustomProperties(java.util.Map<java.lang.String,java.lang.String> customProperties)
Specifies a
java.util.Map which may contain additional
properties for the connection. |
void |
setCustomTrustManagers(java.lang.String customTrustManagers)
Specifies one or more trust manager classes separated by a semicolon (;).
These classes have to implement the Trustmanager interface and need to provide
an empty default constructor to be valid.If you want to accept all security certificates without a check you may consider using the DummyTrustManager class. |
void |
setDebugMode(boolean debugMode)
Specifies if the JavaMail is run in
DEBUG mode. |
void |
setDeleteProcessedMessages(boolean deleteProcessedMessages)
This flag is used to indicate what happens to a processed mail polled
from a mail folder.
|
void |
setMarshaler(AbstractMailMarshaler marshaler)
With this method you can specify a marshaler class which provides the
logic for converting a mail into a normalized message.
|
void |
setMaxFetchSize(int maxFetchSize)
This sets the maximum amount of mails to process within one polling cycle.
|
void |
setProcessOnlyUnseenMessages(boolean processOnlyUnseenMessages)
This flag is used to indicate whether all mails are polled from a
mail folder or only the unseen mails are processed.
If it is set to true only the unseen mails will be
processed.If it is set to false all mails will be processed. |
void |
setStorage(org.apache.servicemix.store.Store storage)
Specifies a
org.apache.servicemix.store.Store object which
will be used for storing the identifications of already processed messages.This store is only used with the POP3 protocol and if unseen mails are processed only. |
void |
start() |
void |
stop() |
getDelay, getExecutor, getFirstTime, getPeriod, getScheduler, handlePollException, isConcurrentPolling, setConcurrentPolling, setDelay, setFirstTime, setPeriod, setScheduleractivate, configureExchangeTarget, deactivate, getRole, getTargetEndpoint, getTargetInterface, getTargetOperation, getTargetService, getTargetUri, setTargetEndpoint, setTargetInterface, setTargetOperation, setTargetService, setTargetUri, validatedone, fail, getChannel, getContext, getExchangeFactory, send, sendSyncgetDefinition, getDescription, getEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toStringpublic java.lang.String getLocationURI()
getLocationURI in class ConsumerEndpointpublic void start()
throws java.lang.Exception
start in interface Endpointstart in class PollingEndpointjava.lang.Exceptionpublic void stop()
throws java.lang.Exception
stop in interface Endpointstop in class PollingEndpointjava.lang.Exceptionpublic void process(javax.jbi.messaging.MessageExchange exchange)
throws java.lang.Exception
process in interface Endpointprocess in class AbstractEndpointjava.lang.Exceptionpublic void poll()
throws java.lang.Exception
poll in class PollingEndpointjava.lang.Exceptionpublic boolean isDeleteProcessedMessages()
public void setDeleteProcessedMessages(boolean deleteProcessedMessages)
This flag is used to indicate what happens to a processed mail polled
from a mail folder. If it is set to true the mail will
be deleted after it was sent into the bus successfully. If set to
false the mail will reside inside the mail folder but will
be marked as already seen.
If the sending of the mail results in an error, the mail will not be
deleted / marked and reprocessed on next run of the polling cycle.
The default value is false
deleteProcessedMessages - a boolean value as flagpublic AbstractMailMarshaler getMarshaler()
public void setMarshaler(AbstractMailMarshaler marshaler)
With this method you can specify a marshaler class which provides the
logic for converting a mail into a normalized message. This class has
to extend the abstract class AbstractMailMarshaler or an
extending class. If you don't specify a marshaler, the
DefaultMailMarshaler will be used.
marshaler - a class which extends AbstractMailMarshalerpublic int getMaxFetchSize()
public void setMaxFetchSize(int maxFetchSize)
This sets the maximum amount of mails to process within one polling cycle. If the maximum amount is reached all other mails in "unseen" state will be skipped.
The default value is -1 (unlimited)maxFetchSize - a int value for maximum to be polled messagespublic boolean isProcessOnlyUnseenMessages()
public void setProcessOnlyUnseenMessages(boolean processOnlyUnseenMessages)
This flag is used to indicate whether all mails are polled from a
mail folder or only the unseen mails are processed.
If it is set to true only the unseen mails will be
processed.
If it is set to false all mails will be processed.
processOnlyUnseenMessages - a boolean value as flagpublic java.lang.String getConnection()
public void setConnection(java.lang.String connection)
Specifies the connection URI used to connect to a mail server.
Templates:
<protocol>://<user>@<host>[:<port>][/<folder>]?password=<password>
OR
<protocol>://<host>[:<port>][/<folder>]?user=<user>;password=<password>
Details:
| Name | Description |
| protocol | the protocol to use (example: pop3 or imap) |
| user | the user name used to log into an account |
| host | the name or ip address of the mail server |
| port | the port number to use (optional) |
| folder | the folder to poll from (optional) |
| password | the password for the login |
connection - a String value containing the connection detailspublic boolean isDebugMode()
public void setDebugMode(boolean debugMode)
Specifies if the JavaMail is run in DEBUG mode. This means
that while connecting to server and processing mails a detailed log
is written to debug output.
This mode is very handy if you are experiencing problems with your
mail server connection and you want to find out what is going wrong
in communication with the server.
true - the debug mode is enabled
false - the debug mode is disabled
debugMode - a boolean value for debug modepublic java.lang.String getCustomTrustManagers()
public void setCustomTrustManagers(java.lang.String customTrustManagers)
Specifies one or more trust manager classes separated by a semicolon (;).
These classes have to implement the Trustmanager interface and need to provide
an empty default constructor to be valid.
If you want to accept all security certificates without a check you may
consider using the DummyTrustManager class. It is actually only
an empty stub without any checking logic.
But be aware that this will be
a security risk in production environments.
customTrustManagers - a String value containing one or more full class names separated by ; charpublic java.util.Map<java.lang.String,java.lang.String> getCustomProperties()
public void setCustomProperties(java.util.Map<java.lang.String,java.lang.String> customProperties)
Specifies a java.util.Map which may contain additional
properties for the connection.
Example for disabling TOP for POP3 headers:
key: "mail.pop3.disabletop"
value: "true"
customProperties - a java.util.Map<String, String> containing connection propertiespublic org.apache.servicemix.store.Store getStorage()
public void setStorage(org.apache.servicemix.store.Store storage)
Specifies a org.apache.servicemix.store.Store object which
will be used for storing the identifications of already processed messages.
This store is only used with the POP3 protocol and if unseen mails are
processed only.
storage - a org.apache.servicemix.store.Store object for storing seen message identsCopyright © 2005-2014 FuseSource. All Rights Reserved.