My First Mule Project

Mule is an integration software I have tried to learn recently. It has an Eclipse-based development environment, and since my work experience is mostly about integration, I kind of felt that I would not have a hard time learning the software. Its development environment Mule Studio offers two approaches to develop the integration code: using the visual editor and the XML editor. With the visual editor, you can drag and drop configurable resources; each of which has a specific function. The XML editor offers a convenient way for developers to modify configurations without opening Mule Studio. Mule is quite reminiscent of TIBCO BusinessWorks, but one of its apparent strengths is that it offers a variety of out of the box functions for integrating with other platforms without using adapters or custom code. Well, I have tried my luck and developed my first Mule project. Upon creating a new project, all the necessary folders and configuration files are automatically added to the project. The canvas of the integration is called the flow. The flow is where you drag and drop endpoints and components.



My sample project flow starts with a JMS endpoint which listens for messages from a particular JMS queue. It uses TIBCO EMS as the JMS server. Echo simply retrieves the message payload which is, in this case, always assumed to be an XML message. The XML is converted into a JAXB object which is used by the Java component to retrieve and display certain data fields. Each resource has configuration tabs on which you need to set configurable parameter values.

For the JMS endpoint, you need to specify the exchange patterns and the queue name on the General tab, as well as the Connector Reference on the References tab. The Connector Reference is a global element of type JMS, which can be reused by other JMS endpoints on the same flow.


In the Advanced tab of the JMS global element, you need to specify the JNDI connection parameters. You would need to add tibjms.jar in the Build Path of the project in order to set the Initial Factory class.


Next, you need to configure XML to JAXB Object component. This component requires a JAXB Context global element, on which you need to specify the package name of your JAXB classes.


You would also need to specify the return class in the Advanced tab of the XML to JAXB Object component.


Basically, I have just created an XML Schema Person.xsd and used the xjc utility of the JDK to generate the JAXB classes. I copied the resulting package into my Mule project.

Lastly, the Java component would accept the Person class as an input object in the General tab, and specify a custom interceptor in the Advanced tab. An interceptor is the class that contains the business logic.



The DisplayPerson class would have to implement the org.mule.api.interceptor.Interceptor interface. You can then run and test this flow on the Eclipse-based Mule Studio.


The configuration XML is automatically generated and is the same as the visual flow. It is reminiscent of the configuration XML file of the Spring Framework.


Comments

  1. Really cool post, highly informative and professionally written and I am glad to be a visitor of this perfect blog, thank you for this rare info! , Regards, mulesoft training in hyderabad

    ReplyDelete
  2. Thank you for sharing wonderful information with us to get some idea about it.
    Mulesoft Online Training
    Mulesoft Online Training india

    ReplyDelete

Post a Comment

Popular posts from this blog

XML Schema and JSON Schema Validation in Mule 4

Parsing a JSON String and Converting it to XML in TIBCO

Using XML To Java in TIBCO BW