Dashboard > GridGain User Guide > Table Of Contents > Developers Guide > Discovery SPI > GridMailDiscoverySpi
GridMailDiscoverySpi
Added by user-1-ds, last edited by morpheus on Jul 31, 2007  (view change)
Labels: 
(None)


Click on Javadoc link to open Javadoc documentation.

Package

org.gridgain.grid.spi.discovery.mail Javadoc

Description

GridMailDiscoverySpi is email implementation of GridDiscoverySpi Javadoc SPI. Email discovery is provided for the cases where nodes from different networks need to participate in a grid. When working with email discovery, make sure that maximum send/receive limit set by mail server is not exceeded. Sometimes it is better to configure your own mail server to avoid such limitations.

Configuration

The following configuration parameters can be used to configure GridMailDiscoverySpi

Setter Method Description Optional Default
setOutHost(String) Javadoc
Outgoing host name for sending emails (usually either SMTP or IMAP). No
setInHost(String) Javadoc
Incoming host name for receiving emails (usually either POP or IMAP). No
setFromAddress(String) Javadoc
'From' address for all email messages. No
setBroadcastAddress(String) Javadoc
Broadcast email address used by node to discover each other. No
setOutConnectionType(GridMailDiscoveryType) Javadoc
Type of outgoing mail connection which should be one of the following:
  • GridMailDiscoveryType.NONE Javadoc
  • GridMailDiscoveryType.SSL Javadoc
  • GridMailDiscoveryType.STARTTLS Javadoc
Yes GridMailDiscoveryType.NONE Javadoc
setOutPort(int) Javadoc
Port number for outgoing mail. Yes Port 25
setOutUsername(String) Javadoc
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) Javadoc
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) Javadoc
Any custom properties required for outgoing connection. Yes null
setOutProtocol(GridMailDiscoveryOutProtocol) Javadoc
Outgoing mail protocol. Should be one of the following:
  • GridMailDiscoveryOutProtocol.SMTP Javadoc
  • GridMailDiscoveryOutProtocol.SMTPS Javadoc
Yes GridMailDiscoveryOutProtocol.SMTP Javadoc
setInConnectionType(GridMailDiscoveryType) Javadoc
Type of incoming mail connection which should be one of the following:
  • GridMailDiscoveryType.NONE Javadoc
  • GridMailDiscoveryType.SSL Javadoc
  • GridMailDiscoveryType.STARTTLS Javadoc
Yes GridMailDiscoveryType.NONE Javadoc
setInPort(int) Javadoc
Port number for incoming mail. Yes Port 110
setInUsername(String) Javadoc
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) Javadoc
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) Javadoc
Any custom properties required for receiving connection. Yes null
setInProtocol(GridMailDiscoveryInProtocol) Javadoc
Incoming mail protocol. Should be one of the following:
  • GridMailDiscoveryInProtocol.POP3 Javadoc
  • GridMailDiscoveryInProtocol.POP3S Javadoc
  • GridMailDiscoveryInProtocol.IMAP Javadoc
  • GridMailDiscoveryInProtocol.IMAPS Javadoc
Yes GridMailDiscoveryInProtocol.POP3 Javadoc
setSubject(String) Javadoc
Email message subject. Yes grid.email.discovery.msg
setFolderName(String) Javadoc
Name of email folder on mail server. Yes Inbox
setStoreFileName(String) Javadoc
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) Javadoc
Number of messages fetched from mail server at a time. Yes 100
setHeartbeatFrequency(long) Javadoc
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 Javadoc )
setReceiverDelay(long) Javadoc
Interval in milliseconds between checking for new messages. Yes 30000 (specified by GridMailDiscoverySpi.DFLT_RECEIVER_DELAY Javadoc )
setPingResponseWait(long) Javadoc
Ping node wait timeout in milliseconds. Yes 60000 (specified by GridMailDiscoverySpi.DFLT_PING_WAIT Javadoc )
setLeaveMessagesOnServer(long) Javadoc
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.

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.10 Build:#528 Nov 29, 2006) - Bug/feature request - Contact Administrators