Library Link To Toggle Frames Print Feedback

Example

Example 7.4, “Chained Route with Two UMOs” shows a chained route definition that uses two UMOs.

Example 7.4. Chained Route with Two UMOs

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mule-configuration PUBLIC "-//SymphonySoft //DTD mule-configuration XML V1.0//EN"
    "http://www.symphonysoft.com/dtds/mule/mule-configuration.dtd">

<mule-configuration id="RouterConfig" version="1.0":gt;
  <description>Chained routing example</description>
  <mule-environment-properties clientMode="true" />

1<endpoint-identifiers>
    <endpoint-identifier name="Processor1" value="vm://message.processor1"/>
    <endpoint-identifier name="Processor2" value="vm://message.processor2"/>
  </endpoint-identifiers>

  ...
    
  <model name="Chained Routers">
2  <mule-descriptor name="Processor1" 
                     implementation="demo.hw.processors.BadGuy">
      <inbound-router>
3      <endpoint address="Processor1" />
      </inbound-router>
    </mule-descriptor>

4  <mule-descriptor name="Processor2"
                    implementation="demo.hw.processors.GoodGuy">
      <inbound-router>
        <endpoint address="Processor2" />
      </inbound-router>
    </mule-descriptor>

5  <mule-descriptor name="SoapJms-To-SoapHttp" 
                     implementation="org.mule.components.simple.PassThroughComponent">
      <inbound-router>
        <endpoint address="wsdl-cxf:res:///wsdl/hello_world.wsdl" 
                  streaming="false" synchronous="true" 
                  transformers="InputStreamToString" />
          <properties>
            <property name="service"
                      value="{http://apache.org/hello_world_soap_http}SOAPService" />
            <property name="port"
                      value="{http://apache.org/hello_world_soap_http}SoapOverJmsRouter" />
            <property name="dataFormat" value="message" />
          </properties>
        </endpoint>
      </inbound-router>

      <outbound-router>
6      <router className="org.mule.routing.outbound.ChainingRouter">
7        <endpoint remoteSync="true" address="Processor1"/>
8        <endpoint remoteSync="true" address="Processor2"/>
9        <endpoint address="wsdl-cxf:res:///wsdl/hello_world.wsdl"
                    synchronous="true"
                    transformers="StringToInputStream" />
            <properties>
              <property name="service"
                        value="{http://apache.org/hello_world_soap_http}SOAPService"/>
              <property name="port"
                        value="{http://apache.org/hello_world_soap_http}SoapOverHttp"/>
              <property name="dataFormat" value="message"/>
            </properties>
          </endpoint>
        </router>
      </outbound-router>
    </mule-descriptor>
  </model>
</mule-configuration>

The route definition shown in Example 7.4, “Chained Route with Two UMOs” does the following;

1

The endpoint-identifiers element and its endpoint-identifier child elements define how the UMOs can be contacted. In this example, the UMOs are running as local VM components.

2

Defines the first UMO and specifies its implementation class.

3

Specifies the address at which the UMO is accessed.

4

Defines the second UMO.

5

Defines the inbound router as a simple pass through router with a single endpoint.

6

Specifies that the outbound router is a chaining router. Chaining outbound routers are implemented by the org.mule.routing.outbound.ChainingRouter class.

7

Specifies that the first UMO, Process1, is the first endpoint in the outbound router's chain.

8

Specifies that the second UMO, Process2, is the second endpoint in the outbound router's chain.

9

Specifies the destinaiton endpoint for the message as the last endpoint in the chain.