Skip navigation

Following the instructions below will create template files, including all the necessary Java boilerplate and detailed implementation instructions in comments, for a new transport.

The transport archetype is publicly available from the central maven repo.

Configuring Maven

Edit the file settings.xml (usually in $HOME/.m2) so that Maven will allow you to execute Mule plugins.

<settings>
    ...
    <pluginGroups>
        <pluginGroup>org.mule.tools</pluginGroup>
    </pluginGroups>
    ...
</settings>

CodeHaus plug-in Repository

You need to have the CodeHaus plug in repository accessible for Maven, to do this just add the following declarations to your settings file above. Later you can activate the codehaus profile using -Pcodehaus.

<settings>
    ...
    <profile>
      <id>codehaus</id>
      <repositories>
        <repository>
          <id>codehaus.org</id>
          <name>CodeHaus Snapshots</name>
          <url>http://snapshots.repository.codehaus.org</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>codehaus.org</id>
          <name>CodeHaus Plugin Snapshots</name>
          <url>http://snapshots.repository.codehaus.org</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
    ...
</settings>

Move to wherever you want to place you code.

> cd yourDir

Next you will execute archetype and generate the code. This will ask various questions and then generate the files.
You need to pass in two system parameters -

transportId The short name of the protocol (i.e. 'tcp' or 'jms') or the application name (i.e. 'sap')
muleVersion The version of Mule you are working with

Note you also need to use the codehaus profile. The command looks like the following (all on one line) -


> mvn -Pcodehaus mule-transport-archetype:create -DtransportId=xxx -DmuleVersion=2.0-M2-SNAPSHOT

Next you'll be asked a number of questions about the transport you are writing. These may vary according to the options you select. An example of the output is shown below.

The Questions Explained

Provide a description of what the transport does:

You should provide an accurate description of the transport with any high level details of what you can or cannot do with it. This text will be used where a description of the project is required.

Will This project be hosted on MuleForge?

If the transport is going to be hosted on MuleForge, then additional information will be added to your project for linking to its issue tracker, web site, build server and deployment information.

Will This transport have a custom schema for configuring the transport in Xml?

It's recommended that all new transports targeted for Mule 2.0 should define an Xml schema that defines how the transport is configured. If you do not use this option, users will have to use generic configuration to use your transport.

Can the transport receive inbound requests?

Can this transport deliver inbound events? For example, the File transport allows you to listen for files written to a directory. Jms allows you to listen for events being written to a topic or queue.

Does the Message Receiver need to poll the underlying resource?

In order to receive 'message' some transports such as FILE need to poll a directory to know its been written there, whereas JMS provides a callback (MessageListener) to deliver the message. This is only asked is the transport can receive inbound requests.

Does this transport support Streaming?

Can a stream be provided by the underlying resource so that streaming of data can be enabled.

If this transport will have a default inbound transformer, enter the name of the transformer?

If the protocol of application being connected to has it's own message type, you can define a default inbound transformer, that will be configured by default when defining endpoints that use this transport. You need to enter the name of the transformer class to generate i.e. JmsMessageToObject.

Can the transport dispatch outbound requests?

Can events be written to this transport. In the case of FILE, you can write file data to a directory and with JMS you can write to a queue or topic.

If this transport will have a default outbound transformer, enter the name of the transformer?

If the protocol of application being connected to has it's own message type, you can define a default outbound transformer, that will be configured by default when defining outbound endpoints that use this transport. You need to enter the name of the transformer class to generate i.e. ObjectToJmsMessage.

Does this transport support transactions?

If the underlying resource for this transport is transactional, you can have Mule generate a transaction wrapper that will allow users to enables transactions on endpoints defined using this transport.

Does this transport use a non-JTA Transaction manager?

Not all technologies (such as JavaSpaces) support the standard JTA transaction manager. Mule can still work with different non-JTA Transaction Managers, and this archetype can generate the necessary stubs for you.

What type of Endpoints does this transport use?

Mule supports a number of well defined endpoints -

The custom option allows you to deviate from the existing endpoint styles and parse your own.

Example console output


********************************************************************************

               Provide a description of what the transport does:                
                                                                     [default: ]
********************************************************************************
I really don't want to talk about it
[INFO] ForgeProject: 
********************************************************************************

              Will This project be hosted on MuleForge? [y] or [n]              
                                                                    [default: y]
********************************************************************************

[INFO] CustomSchema: 
********************************************************************************

 Will This transport have a custom schema for configuring the transport in Xml? 
                                                                    [default: y]
********************************************************************************

[INFO] Receiver: 
********************************************************************************

             Can the transport receive inbound requests? [y] or [n]             
                                                                    [default: y]
********************************************************************************

[INFO] PollingMessageReceiver: 
********************************************************************************

   Does the Message Receiver need to poll the underlying resource? [y] or [n]   
                                                                    [default: n]
********************************************************************************

[INFO] Streaming: 
********************************************************************************

               Does this transport support Streaming? [y] or [n]                
                                                                    [default: n]
********************************************************************************

[INFO] InboundTransformer: 
********************************************************************************

If this transport will have a default inbound transformer, enter the name of the
                        transformer? (i.e. JmsMessageToObject)
                                                                    [default: n]
********************************************************************************

[INFO] Dispatcher: 
********************************************************************************

                 Can the transport dispatch outbound requests?                  
                                                                    [default: y]
********************************************************************************

[INFO] OutboundTransformer: 
********************************************************************************

If this transport will have a default outbound transformer, enter the name of the
                        transformer? (i.e. ObjectToJmsMessage)
                                                                    [default: n]
********************************************************************************

[INFO] Transactions: 
********************************************************************************

              Does this transport support transactions? [y] or [n]              
                                                                    [default: n]
********************************************************************************

[INFO] EndpointBuilder: 
********************************************************************************

What type of Endpoints does this transport use?
                - [r]esource endpoints (i.e. jms://my.queue)
                - [u]rl endpoints (i.e. http://localhost:1234/context/foo?param=1)
                - [s]ocket endpoints (i.e. tcp://localhost:1234)
                - [c]ustom - parse your own
                                                                    [default: r]
********************************************************************************

Adaptavist Theme Builder Powered by Atlassian Confluence