MULE ESB Config Snippet: Most Simple Flow

For the first sample I create, I show all the details, subsequently I will only quote the configuration file.

  1. Create a new Mule Project
    (without sample code)

    New Mule Project

  2. Create a new configuration
    (add only standard I/O)

    New Configuration

    New Configuration

  3. This is an empty configuration file. You will always start from here.
    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio"
    
          xsi:schemaLocation="
              http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
              http://www.mulesoft.org/schema/mule/stdio http://www.mulesoft.org/schema/mule/stdio/3.1/mule-stdio.xsd">
    
    </mule
    

    This does basically nothing.

  4. The most basic concept you need to understand:
    • A flow describes the sequence of activities that happen to a piece of information (message)
    • You define one or more connectors
    • A message comes from somewhere (inbound-endpoint)
    • You do something to it (or not)
    • The message goes somewhere (outbound-endpoint)
  5. The most simple flow I could think of: You enter a value at the console and you get it back at the console !
    Refer to the stdio document for parameters.

    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio"
    
          xsi:schemaLocation="
              http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
              http://www.mulesoft.org/schema/mule/stdio http://www.mulesoft.org/schema/mule/stdio/3.1/mule-stdio.xsd">
    
    	<stdio:connector name="stdioConnector" messageDelayTime="1000" promptMessage="IN: " outputMessage="OUT:  "  />
    
    	<flow name="SimpleFlow">
    		<stdio:inbound-endpoint system="IN"  exchange-pattern="one-way" connector-ref="stdioConnector"/>
    		<stdio:outbound-endpoint system="OUT" exchange-pattern="one-way" connector-ref="stdioConnector"/>
    	</flow>
    </mule>
    

     

  6. Run (better Debug) the configuraion. Run as Mule Server
    If you debug, you can terminate the Mule server from eclipse, if you run you wont be able to stop the server (due to some plugin bug I guess)

    Run Mule Server

    Mule Server Running

Getting started with MULE ESB

Eclipse is the tool to create Mule flows and run or debug them. I can skip the part how you install eclipse and the required plugin, it is all documented at here and here.
I recommend reading the 10-minutes intro and the documents describing the concepts (also downloadable as pdf!). Look at the sample projects (Echo and Hello first) that come with the eclipse plugin and create your own projects, by experimenting you certainly get the fastest take-off.

New Mule project

MULE ESB

Confronted with some integration work, I was looking around for an opensource ESB solution, with a community and enterprise version at a reasonable price-range. Previously I followed openESB by SUN, but the project died in 2010 after the Oracle deal. At some stage ESB was very popular with consultants as the silver bullet for integration problems. The crowd moved on (to cloud computing as consultancy topic), the dust settled and you can have a serious look at the remaining products out there. Have a look at Wikipedias summary. Having only Apache Camel and Servicemix left on my list I came across MULE ESB.

Getting my hands dirty with MULE configurations, I get the hang on it and quite like the product ! Lots of transports and connectors, a good documentation and recently they added visual (eclipse based) IDE to create flows.
I still recommend to learn the configuration “language” first to understand the underlying concepts. I will share some of my experiences and sandbox activities here.

MULE ESB