|
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.communication.mule.GridMuleCommunicationSpi
@GridSpiInfo(author="GridGain Systems",
url="www.gridgain.org",
email="support@gridgain.com",
version="x.x")
@GridSpiMultipleInstancesSupport(value=false)
public class GridMuleCommunicationSpi
Mule implementation of GridCommunicationSpi SPI. It uses
Mule ESB implementation to communicate with GridGain nodes.
Mule instance may be started before SPI or instantiated during SPI start.
SPI uses UMO component which must be declared in Mule configuration file
(see GridMuleCommunicationSpi.COMPONENT_NAME). UMO component should have one input endpoint.
The name of that input endpoint should be declared in
component's descriptor properties (see GridMuleCommunicationSpi.ENDPOINT_NAME).
Here is an example of Mule configuration file with
GridMuleCommunicationComponent used by this SPI:
<mule-configuration version="1.0">
<mule-environment-properties embedded="true"/>
<connector name="tcpConnector" className="org.mule.providers.tcp.TcpConnector">
<properties>
<property name="tcpProtocolClassName" value="org.mule.providers.tcp.protocols.LengthProtocol"/>
</properties>
</connector>
<model name="gridgain">
<mule-descriptor name="GridCommunicationUMO"
implementation="org.gridgain.grid.spi.communication.mule.GridMuleCommunicationComponent"
singleton="true">
<inbound-router>
<endpoint name="comm.id" address="tcp://localhost:11001"/>
</inbound-router>
<properties>
<property name="communication" value="comm.id"/>
</properties>
</mule-descriptor>
</model>
</mule-configuration>
This SPI has no mandatory parameters.
This SPI has the following optional parameters:
GridMuleCommunicationSpi.setConfigurationFile(String), GridMuleCommunicationSpi.setConfigurationUrl(URL)).
GridMuleCommunicationSpi.setComponentName(String)}).
GridMuleCommunicationSpi commSpi = new GridMuleCommunicationSpi();
commSpi.setConfigurationFile("/my/path/to/mule/config/mule.xml");
GridConfigurationAdapter cfg = new GridConfigurationAdapter();
// Override default communication SPI.
cfg.setCommunicationSpi(commSpi);
// Start grid.
GridFactory.start(cfg);
<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true">
...
<property name="communicationSpi">
<bean class="org.gridgain.grid.spi.communication.mule.GridMuleCommunicationSpi">
<property name="configurationFile" value="/my/config/path/mule.xml"/>
</bean>
</property>
...
</bean>
Note: Mule is not shipped with GridGain. If you don't have Mule, you need to download it separately. See http://www.mulesource.com for more information. Once installed, Mule should be available on the classpath for GridGain. If you use [GRIDGAIN_HOME]/bin/gridgain.{sh|bat} script to start a grid node you can simply add Mule JARs to [GRIDGAIN_HOME]/bin/setenv.{sh|bat} script that is used to set up class path for the main scripts.
Note: When using Mule SPI (communication or discovery) you cannot start
multiple GridGain instances in the same VM due to Mule limitation. GridGain runtime
will detect this situation and prevent GridGain from starting in such case.
See GridSpiMultipleInstancesSupport for details.
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
GridCommunicationSpi
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
static String |
ATTR_ADDR
Name of address attribute added to local node attributes at startup (value is grid.comm.mule.address). |
static String |
COMPONENT_NAME
Name of component declared in Mule configuration (value is GridCommunicationUMO). |
static String |
DFLT_CONFIG_FILE
Default Mule 1.x configuration path relative to GridGain installation home folder (value is config/mule1/mule.xml). |
static String |
ENDPOINT_NAME
Name of property where input endpoint name declared in Mule configuration (value is communication). |
| Constructor Summary | |
|---|---|
GridMuleCommunicationSpi()
|
|
| Method Summary | |
|---|---|
String |
getComponentName()
Gets name for the component registered in Mule configuration. |
String |
getConfigurationFile()
Gets either absolute or relative to GridGain installation home folder path to Mule XML configuration file. |
protected List<String> |
getConsistentAttributeNames()
Returns back list of attributes that should be consistent for this SPI. |
String |
getEndpointUri()
Gets component input endpoint URI. |
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. |
void |
sendMessage(Collection<GridNode> destNodes,
Serializable msg)
Sends given message to destination nodes. |
void |
sendMessage(GridNode destNode,
Serializable msg)
Sends given message to destination node. |
void |
setComponentName(String umoName)
Sets name for component registered in Mule. |
void |
setConfigurationFile(String cfgFile)
Sets either absolute or relative to GridGain installation home folder path to Mule XML configuration file. |
void |
setConfigurationUrl(URL cfgUrl)
Sets URL to Mule XML configuration file. |
void |
setListener(GridMessageListener listener)
Set communication listener. |
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 String DFLT_CONFIG_FILE
public static final String ATTR_ADDR
public static final String COMPONENT_NAME
public static final String ENDPOINT_NAME
| Constructor Detail |
|---|
public GridMuleCommunicationSpi()
| Method Detail |
|---|
public String getConfigurationFile()
getConfigurationFile in interface GridMuleCommunicationSpiMBean@GridSpiConfiguration(optional=true) public void setConfigurationFile(String cfgFile)
If not provided, default value is GridMuleCommunicationSpi.DFLT_CONFIG_FILE.
cfgFile - Path to Mule configuration file.@GridSpiConfiguration(optional=true) public void setConfigurationUrl(URL cfgUrl)
If not provided, default value is GridMuleCommunicationSpi.DFLT_CONFIG_FILE.
cfgUrl - URL to Mule configuration file.public String getComponentName()
getComponentName in interface GridMuleCommunicationSpiMBean@GridSpiConfiguration(optional=true) public void setComponentName(String umoName)
umoName - Name for component registered in Mule.public String getEndpointUri()
getEndpointUri in interface GridMuleCommunicationSpiMBean
public Map<String,Serializable> getNodeAttributes()
throws GridSpiException
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.
getNodeAttributes in interface GridSpigetNodeAttributes in class GridSpiAdapterGridSpiException - Throws in case of any error.
public void spiStart(String gridName)
throws GridSpiException
spiStart in interface GridSpiGridSpiException - Throws in case of any error during SPI start.gridName - Name of grid instance this SPI is being started for
(null for default grid).
public void spiStop()
throws GridSpiException
spiStop in interface GridSpiGridSpiException - Thrown in case of any error during SPI stop.
public void sendMessage(GridNode destNode,
Serializable msg)
throws GridSpiException
sendMessage in interface GridCommunicationSpiGridSpiException - Thrown in case of any error during sending the message.
Note that this is not guaranteed that failed communication will result
in thrown exception as this is dependant on SPI implementation.destNode - Destination node.msg - Message to send.
public void sendMessage(Collection<GridNode> destNodes,
Serializable msg)
throws GridSpiException
sendMessage in interface GridCommunicationSpiGridSpiException - Thrown in case of any error during sending the message.
Note that this is not guaranteed that failed communication will result
in thrown exception as this is dependant on SPI implementation.destNodes - Destination nodes.msg - Message to send.public void setListener(GridMessageListener listener)
setListener in interface GridCommunicationSpilistener - Listener to set or null to unset the listener.protected List<String> getConsistentAttributeNames()
getConsistentAttributeNames in class GridSpiAdapterpublic String toString()
toString in class Object
|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
|
GridGain - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved. |
|
|