Click on Javadoc link to open Javadoc documentation.
Package
org.gridgain.grid.spi.discovery.mail ![]()
Description
GridMailDiscoverySpi is email implementation of GridDiscoverySpi ![]()
Configuration
The following configuration parameters can be used to configure GridMailDiscoverySpi
| Setter Method | Description | Optional | Default |
|---|---|---|---|
| setOutHost(String) |
Outgoing host name for sending emails (usually either SMTP or IMAP). | No | — |
| setInHost(String) |
Incoming host name for receiving emails (usually either POP or IMAP). | No | — |
| setFromAddress(String) |
'From' address for all email messages. | No | — |
| setBroadcastAddress(String) |
Broadcast email address used by node to discover each other. | No | — |
| setOutConnectionType(GridMailDiscoveryType) |
Type of outgoing mail connection which should be one of the following: | Yes | GridMailDiscoveryType.NONE |
| setOutPort(int) |
Port number for outgoing mail. | Yes | Port 25 |
| setOutUsername(String) |
Username for outgoing mail authentication. If provided, then password should also be provided. | Yes | null, which means that no authentication will be used. |
| setOutPassword(String) |
Password for outgoing mail authentication. If provided, then username should also be provided. | Yes | null, which means that no authentication will be used. |
| setOutCustomProperties(Properties) |
Any custom properties required for outgoing connection. | Yes | null |
| setOutProtocol(GridMailDiscoveryOutProtocol) |
Outgoing mail protocol. Should be one of the following: | Yes | GridMailDiscoveryOutProtocol.SMTP |
| setInConnectionType(GridMailDiscoveryType) |
Type of incoming mail connection which should be one of the following: | Yes | GridMailDiscoveryType.NONE |
| setInPort(int) |
Port number for incoming mail. | Yes | Port 110 |
| setInUsername(String) |
Username for incoming mail authentication. If provided, then password should also be provided. | Yes | null, which means that no authentication will be used. |
| setInPassword(String) |
Password for incoming mail authentication. If provided, then username should also be provided. | Yes | null, which means that no authentication will be used. |
| setInCustomProperties(Properties) |
Any custom properties required for receiving connection. | Yes | null |
| setInProtocol(GridMailDiscoveryInProtocol) |
Incoming mail protocol. Should be one of the following: | Yes | GridMailDiscoveryInProtocol.POP3 |
| setSubject(String) |
Email message subject. | Yes | grid.email.discovery.msg |
| setFolderName(String) |
Name of email folder on mail server. | Yes | Inbox |
| setStoreFileName(String) |
Locally stored full file name for all read messages. Can be either full path or a path relative to ${GRIDGAIN_HOME} | Yes | grid-email-discovery-msgs.dat |
| setReadBatchSize(int) |
Number of messages fetched from mail server at a time. | Yes | 100 |
| setHeartbeatFrequency(long) |
Delay between heartbeat requests. SPI sends broadcast messages in configurable time interval to other nodes to notify them about its state. | Yes | 60000 (specified by GridMailDiscoverySpi.DFLT_HEARTBEAT_FREQ |
| setReceiverDelay(long) |
Interval in milliseconds between checking for new messages. | Yes | 30000 (specified by GridMailDiscoverySpi.DFLT_RECEIVER_DELAY |
| setPingResponseWait(long) |
Ping node wait timeout in milliseconds. | Yes | 60000 (specified by GridMailDiscoverySpi.DFLT_PING_WAIT |
| setLeaveMessagesOnServer(long) |
Incoming messages life-time on mail server in milliseconds. | Yes | 86400000 ms |
Examples
GridMailDiscoverySpi needs to be explicitly configured to override default Multicast discovery SPI.
GridMailDiscoverySpi spi = new GridMailDiscoverySpi(); // Inbox configuration. spi.setInHost("pop.google.com"); // Outbox configuration. spi.setOutHost("smtp.google.com"); // Incoming/outgoing e-mail address configuration. spi.setFromAddress("grid@google.com"); // Broadcast address. spi.setBroadcastAddress("grid-broadcast@google.com") GridConfigurationAdapter cfg = new GridConfigurationAdapter(); // Override default discovery SPI. cfg.setDiscoverySpi(spi); // Start grid. GridFactory.start(cfg);
or from Spring configuration file
<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true"> ... <property name="discoverySpi"> <bean class="org.gridgain.grid.spi.discovery.mail.GridMailDiscoverySpi"> <property name="outHost" value="smtp.google.com"/> <property name="inHost" value="pop.google.com"/> <property name="fromAddress" value="grid@google.com"/> <property name="broadcastAddress" value="grid-broadcast@google.com"/> </bean> </property> ... </bean>

For more information about using Spring framework for configuration click here.
