Dashboard > GridGain User Guide > Table Of Contents > Developers Guide > Communication SPI > GridMuleCommunicationSpi
GridMuleCommunicationSpi
Added by morpheus, last edited by morpheus on Jul 30, 2007  (view change)
Labels: 
(None)


Click on Javadoc link to open Javadoc documentation.

Package

org.gridgain.grid.spi.communication.mule Javadoc

Description

Mule implementation of GridCommunicationSpi Javadoc 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. UMO component should have one input endpoint. The name of that input endpoint should be declared in component's descriptor properties.

Libraries

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.

Multiple Instances In VM

When using Mule SPI (communication or discovery) you cannot start multiple GridGain instances in the same VM due to Mule limitiation. GridGain runtime will detect this situation and prevent GridGain from starting in such case. See GridSpiMultipleInstancesSupport Javadoc for details.

Configuration

The following configuration parameters can be used to configure GridMuleCommuncationSpi Javadoc

Setter Method Description Optional Default
setConfigurationFile(String) Javadoc Sets Mule configuration file used when Mule instance isn't already started. Yes {GRIDGAIN_HOME}/config/mule/communication/mule.xml
setComponentName(String) Javadoc Sets component name that was declared in Mule configuration. Yes GridCommunicationUMO

Here is an example of Mule configuration file with GridMuleCommunicationComponent Javadoc used by this SPI:

<!DOCTYPE mule-configuration PUBLIC "-//MuleSource //DTD mule-configuration XML V1.0//EN"
    "http://mule.mulesource.org/dtds/mule-configuration.dtd">

<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>

Examples

As any GridGain SPI, GridMuleCommunicationSpi Javadoc can be configured either directly from code or from Spring configuration file. Here is an example of GridMuleCommunicationSpi Javadoc configuration from code:

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);

or from Spring configuration file

<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/mule/communication/mule.xml"/>
            </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