|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gridgain.grid.spi.GridSpiAdapter
org.gridgain.grid.spi.discovery.mail.GridMailDiscoverySpi
@GridSpiInfo(author="GridGain Systems",
url="www.gridgain.org",
email="support@gridgain.com",
version="x.x")
@GridSpiMultipleInstancesSupport(value=true)
public class GridMailDiscoverySpi
Email implementation of GridDiscoverySpi. Email discovery is
provided for 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.
GridMailDiscoverySpi.setOutHost(String)).GridMailDiscoverySpi.setInHost(String)).GridMailDiscoverySpi.setFromAddress(String)).GridMailDiscoverySpi.setBroadcastAddress(String)).GridMailDiscoverySpi.setHeartbeatFrequency(long)GridMailDiscoverySpi.setReceiverDelay(long)GridMailDiscoverySpi.setPingResponseWait(long)GridMailDiscoverySpi.setMaxMissedHeartbeats(long)GridMailDiscoverySpi.setLeaveMessagesOnServer(long)GridMailDiscoverySpi.setOutUsername(String)GridMailDiscoverySpi.setOutPassword(String)GridMailDiscoverySpi.setOutConnectionType(GridMailDiscoveryType))GridMailDiscoverySpi.setOutProtocol(GridMailDiscoveryOutProtocol) GridMailDiscoverySpi.setOutPort(int)GridMailDiscoverySpi.setOutCustomProperties(Properties)GridMailDiscoverySpi.setInConnectionType(GridMailDiscoveryType)GridMailDiscoverySpi.setInPort(int)GridMailDiscoverySpi.setInUsername(String)GridMailDiscoverySpi.setInPassword(String)GridMailDiscoverySpi.setInCustomProperties(Properties)GridMailDiscoverySpi.setInProtocol(GridMailDiscoveryInProtocol) GridMailDiscoverySpi.setSubject(String)GridMailDiscoverySpi.setFolderName(String)GridMailDiscoverySpi.setStoreFileName(String) GridMailDiscoverySpi.setReadBatchSize(int)
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);
<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 information about Spring framework visit www.springframework.org
See Also:
Documentation
Email Support
Online Forums
Issue Tracking
Author: 2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0
GridDiscoverySpi
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
static long |
DFLT_HEARTBEAT_FREQ
Default heartbeat delay (value is 60000). |
static long |
DFLT_LEAVE_MSGS_ON_SERVER
Leave messages on server in milliseconds (value is ( GridMailDiscoverySpi.DFLT_MAX_MISSED_HEARTBEATS + 2) * GridMailDiscoverySpi.DFLT_HEARTBEAT_FREQ). |
static String |
DFLT_MAIL_SUBJECT
Default subject of email (value is grid.email.discovery.msg). |
static int |
DFLT_MAX_MISSED_HEARTBEATS
Default number of heartbeat messages that could be missed (value is 3). |
static long |
DFLT_PING_WAIT
Default ping wait timeout (value is GridMailDiscoverySpi.DFLT_RECEIVER_DELAY * 2). |
static long |
DFLT_RECEIVER_DELAY
Delay in milliseconds between receiving email (value is 30000). |
static String |
DFLT_STORE_FILE_NAME
Default local storage file name (value is grid-email-discovery-msgs.dat). |
| Constructor Summary | |
|---|---|
GridMailDiscoverySpi()
Creates discovery SPI. |
|
| Method Summary | |
|---|---|
String |
getBroadcastAddress()
Gets broadcast address used for sending broadcast messages. |
protected List<String> |
getConsistentAttributeNames()
Returns back list of attributes that should be consistent for this SPI. |
String |
getFolderName()
Gets folder name for incoming mail. |
String |
getFromAddress()
Gets message field 'From' all email messages. |
long |
getHeartbeatFrequency()
Gets delay between heartbeat requests. |
String |
getInConnectionTypeFormatted()
Gets type of ingoing mail connection. |
Properties |
getInCustomProperties()
Gets custom properties required for receiving connection. |
String |
getInHost()
Gets incoming host name for receiving email. |
int |
getInPort()
Gets port number for incoming mail. |
String |
getInProtocolFormatted()
Gets incoming mail protocol. |
String |
getInUsername()
Gets username for incoming mail authentication. |
long |
getLeaveMessagesOnServer()
Gets incoming messages life-time on mail server in milliseconds. |
GridNode |
getLocalNode()
Gets local node. |
long |
getMaximumMissedHeartbeats()
Gets number of heartbeat requests that could be missed before remote node is considered to be failed. |
GridNode |
getNode(UUID nodeId)
Gets node by ID. |
Map<String,Serializable> |
getNodeAttributes()
This method is called before SPI starts (before method GridSpi.spiStart(String)
is called). It allows SPI implementation to add attributes to a local
node. Kernel collects these attributes from all SPI implementations
loaded up and then passes it to discovery SPI so that they can be
exchanged with other nodes. |
String |
getOutConnectionTypeFormatted()
Gets type of outgoing mail connection. |
Properties |
getOutCustomProperties()
Gets custom properties required for outgoing connection. |
String |
getOutHost()
Gets outgoing host name for sending email. |
int |
getOutPort()
Gets port number for outgoing mail. |
String |
getOutProtocolFormatted()
Gets outgoing mail protocol. |
String |
getOutUsername()
Gets username for outgoing mail authentication. |
long |
getPingResponseWait()
Gets ping wait timeout in milliseconds. |
int |
getReadBatchSize()
Gets number of messages fetched from mail server at a time. |
long |
getReceiverDelay()
Gets interval in milliseconds between checking for new messages. |
int |
getRemoteNodeCount()
Gets the number of remote nodes. |
Collection<UUID> |
getRemoteNodeIds()
Gets collection of remote nodes' IDs. |
List<GridNode> |
getRemoteNodes()
Gets collection of remote nodes in grid or empty collection if no remote nodes found. |
String |
getStoreFileName()
Gets locally stored full file name for all read messages. |
String |
getSubject()
Gets email message subject. |
boolean |
pingNode(UUID nodeId)
Pings the remote node to see if it's alive. |
void |
setBroadcastAddress(String bcastAddr)
Sets broadcast email address used by node to discover each other. |
void |
setFolderName(String folderName)
Sets name of email folder on mail server. |
void |
setFromAddress(String addr)
Sets 'From' address for all email messages. |
void |
setHeartbeatFrequency(long beatFreq)
Sets delay between heartbeat requests. |
void |
setInConnectionType(GridMailDiscoveryType type)
Sets type of incoming mail connection which should be one of the following: GridMailDiscoveryType.NONE
GridMailDiscoveryType.SSL
GridMailDiscoveryType.STARTTLS
If not provided the default value is GridMailDiscoveryType.NONE. |
void |
setInCustomProperties(Properties props)
Sets any custom properties required for receiving connection. |
void |
setInHost(String host)
Sets incoming host name for receiving email messages (usually either POP or IMAP). |
void |
setInPassword(String pswd)
Sets password for incoming mail authentication. |
void |
setInPort(int port)
Sets port number for incoming mail. |
void |
setInProtocol(GridMailDiscoveryInProtocol proto)
Sets incoming mail protocol. |
void |
setInUsername(String username)
Sets username for incoming mail authentication. |
void |
setLeaveMessagesOnServer(long leaveMsgsOnServer)
Sets incoming messages life-time on mail server in milliseconds. |
void |
setListener(GridDiscoveryListener listener)
Sets a listener for discovery events. |
void |
setMaxMissedHeartbeats(long maxMissedBeats)
Sets number of heartbeat requests that could be missed before remote node is considered to be failed. |
void |
setMetricsProvider(GridDiscoveryMetricsProvider metricsProvider)
Sets discovery metrics provider. |
void |
setNodeAttributes(Map<String,Serializable> attrs)
Sets node attributes which will be distributed in grid during join process. |
void |
setOutConnectionType(GridMailDiscoveryType type)
Sets type of outgoing mail connection which should be one of the following: GridMailDiscoveryType.NONE
GridMailDiscoveryType.SSL
GridMailDiscoveryType.STARTTLS
If not provided the default value is GridMailDiscoveryType.NONE. |
void |
setOutCustomProperties(Properties props)
Sets any custom properties required for outgoing connection. |
void |
setOutHost(String host)
Sets outgoing host name for sending email messages (usually either SMTP or IMAP). |
void |
setOutPassword(String pswd)
Sets password for outgoing mail authentication. |
void |
setOutPort(int port)
Sets port number for outgoing mail. |
void |
setOutProtocol(GridMailDiscoveryOutProtocol proto)
Sets outgoing mail protocol. |
void |
setOutUsername(String username)
Sets username for outgoing mail authentication. |
void |
setPingResponseWait(long pingWait)
Sets ping node wait timeout in milliseconds. |
void |
setReadBatchSize(int readBatchSize)
Sets number of messages fetched from mail server at a time. |
void |
setReceiverDelay(long recvDelay)
Sets interval in milliseconds between checking for new messages. |
void |
setStoreFileName(String fileName)
Sets locally stored full file name for all read messages. |
void |
setSubject(String subj)
Sets email message subject. |
void |
spiStart(String gridName)
This method is called to start SPI. |
void |
spiStop()
This method is called to stop SPI. |
String |
toString()
|
| Methods inherited from class org.gridgain.grid.spi.GridSpiAdapter |
|---|
assertParameter, configInfo, createSpiAttributeName, getAuthor, getGridGainHome, getLocalNodeId, getName, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion, onContextDestroyed, onContextInitialized, registerMBean, setName, setSpiContext, startInfo, startStopwatch, stopInfo, unregisterMBean |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.gridgain.grid.spi.GridSpi |
|---|
getName, onContextDestroyed, onContextInitialized |
| Methods inherited from interface org.gridgain.grid.spi.GridSpiManagementMBean |
|---|
getAuthor, getGridGainHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion |
| Field Detail |
|---|
public static final long DFLT_HEARTBEAT_FREQ
public static final long DFLT_RECEIVER_DELAY
public static final long DFLT_PING_WAIT
GridMailDiscoverySpi.DFLT_RECEIVER_DELAY * 2).
public static final int DFLT_MAX_MISSED_HEARTBEATS
public static final long DFLT_LEAVE_MSGS_ON_SERVER
GridMailDiscoverySpi.DFLT_MAX_MISSED_HEARTBEATS + 2) * GridMailDiscoverySpi.DFLT_HEARTBEAT_FREQ).
public static final String DFLT_MAIL_SUBJECT
public static final String DFLT_STORE_FILE_NAME
| Constructor Detail |
|---|
public GridMailDiscoverySpi()
| Method Detail |
|---|
public long getHeartbeatFrequency()
getHeartbeatFrequency in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setHeartbeatFrequency(long beatFreq)
If not provided the default value is GridMailDiscoverySpi.DFLT_HEARTBEAT_FREQ.
beatFreq - Time in milliseconds.public long getReceiverDelay()
getReceiverDelay in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setReceiverDelay(long recvDelay)
If not provided the default value is GridMailDiscoverySpi.DFLT_RECEIVER_DELAY.
recvDelay - Interval between receiving messages.public long getPingResponseWait()
getPingResponseWait in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setPingResponseWait(long pingWait)
If not provided the default value is GridMailDiscoverySpi.DFLT_PING_WAIT.
pingWait - Timeout in milliseconds.public GridNode getLocalNode()
getLocalNode in interface GridDiscoverySpipublic long getMaximumMissedHeartbeats()
getMaximumMissedHeartbeats in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setMaxMissedHeartbeats(long maxMissedBeats)
If not provided the default value is GridMailDiscoverySpi.DFLT_MAX_MISSED_HEARTBEATS.
maxMissedBeats - Number of missed requests.public long getLeaveMessagesOnServer()
getLeaveMessagesOnServer in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setLeaveMessagesOnServer(long leaveMsgsOnServer)
If not provided the default value is GridMailDiscoverySpi.DFLT_LEAVE_MSGS_ON_SERVER.
leaveMsgsOnServer - Time to live for incoming messages.public String getOutConnectionTypeFormatted()
getOutConnectionTypeFormatted in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setOutConnectionType(GridMailDiscoveryType type)
If not provided the default value is GridMailDiscoveryType.NONE.
type - Connection type.public String getOutProtocolFormatted()
getOutProtocolFormatted in interface