Mule

How message in Mule is composed ?

A Mule message is composed of different parts:

The payload, which is the main data content carried by the message.

The properties, which contain the meta information much like the header of a SOAP envelope or the properties of a JMS message.

Optionally, multiple named attachments, to support the notion of multipart messages.

Optionally, an exception payload, which holds any error that occurred during the processing of the event.

What are configuration builders in Mule ?

Mule uses configuration builders that can translate a human-authored configuration file into the complex graph of objects that constitutes a running node of this ESB. The main builders are of two kinds: a Spring-driven builder, which works with XML files, and a script builder, which can accept scripting language files.

Why Spring-driven configuration builder is important than script builder ?

The advantages of Spring-driven configuration builder

It is the most popular — you are more likely to find examples using this syntax.

It is the most user friendly — Spring takes care of wiring together all the moving parts of the ESB, something you must do by hand with a script builder.

It is the most expressive — dedicated XML schemas define the domain-specific language of Mule, allowing you to handle higher-level concepts than the scripting approach does.

What is bridge component in Mule ?

A bridge component is used to pass the messages from the inbound router to the outbound one. A bridge is a neutral component: it does not perform any action or modify messages that it processes.

What tags are used to configure spring elements in Mule ?

Tags like <spring:bean/> <spring:entry/> etc. are used to configure spring stuff.

What are available approaches used for modularizing configurations in Mule ?

There are different following approaches that can be used when modularizing a configuration.

Independent configurations – a Mule instance can load several independent configuration files side by side.

Inherited configurations – main idea is to express a formal parent-child dependency between two configurations. By strongly expressing this dependency, you will have the guarantee at boot time that no configuration file has been omitted.

Simply by using the same name for the parent and child models and by flagging the child as being an heir, as shown here:

<model name="myConfig">
<model name="myConfig" inherit="true">

Imported configurations – You can easily import external Spring application context files into your Mule configuration files. The following illustrates how instance.xml would import its Spring context file:

<spring:beans>
      <spring:import resource="instance-beans.xml" />
</spring:beans>

Heterogeneous configurations – It is possible to mix several styles of Mule configuration in an instance. An instance can be configured with a Groovy script and Spring XML configuration builders.

Give an example of stdio connector in Mule ?

<stdio:connector name="SystemStreamConnector" promptMessage="Please enter something: " messageDelayTime="1000" />

Give an example of http connector in Mule ?

<http:connector name="HttpConnector" proxyHostname="proxyHostname" proxyPort="proxyPort" proxyUsername="proxyUsername" proxyPassword="proxyPassword" />

When does Mule instantiates a connector ?

If Mule figures out that one of our endpoints needs a particular connector, it will automatically instantiate one for us, using all the default values for its different configuration parameters. This is a perfectly viable approach if we are satisfied with the behavior of the connector when it uses its default configuration. This is often the case for the VM or HTTP transports. Note that Mule will name these default connectors with monikers such as connector.http.0.

What is Transport Service Descriptor in Mule ?

The connector has a technical configuration known as the Transport Service Descriptor (TSD). This hidden configuration is automatically used for each instance of the connector. It defines technical parameters such as what classes to use for the message receivers, requesters, and dispatchers; or the default transformers to use in inbound, outbound, and response routers. Knowing these default values is essential to grasping the behavior of a transport.

How many endpoints are there in Mule ?

There are two endpoints : inbound and outbound.

You will use inbound and outbound endpoints to communicate between components and services inside Mule as well as with the outside world.

What is an inbound endpoint in Mule ?

Inbound endpoints are used to accept data. An inbound endpoint can do things such as receive SOAP messages, read file streams, and pull down email messages.

What is an outbound endpoint in Mule ?

Outbound endpoints are used to send data. An outbound endpoint is used to do things such as send SOAP messages, write to file streams, and send email messages.

What is global endpoint in Mule ?

An endpoint destination that is shared by several routers, it is worth creating a global endpoint. A global endpoint is not typified for inbound or outbound routing, making it usable in many different places in a configuration file. It must be named so it can actually be used in a service, which will reference the global endpoint by its name. A global endpoint can also help clarify the usage of a particular destination.

Why does an endpoint in Mule offer an address attribute ?

This allows us to configure a generic endpoint using the Mule 1.x style of URI-based destination addresses instead of the dedicated attributes of the specific endpoint element.

Give an example of file endpoint in Mule ?

<file:endpoint name="tmpPoller" path="/tmp" fileAge="1000" pollingFrequency="2000"/>

What is streaming property in file connector in Mule ?

The value of this streaming property can be either true or false. If it is set to true then we are actually working on stream of file data otherwise we are working with file itself.

What is pollingFrequency property in file connector in Mule ?

When we want file inbound endpoints to poll their source directories for new content. This is accomplished by setting the pollingFrequency to some milliseconds value.

What is autoDelete property in file connector in Mule ?

The default value of autoDelete is true. Therefore, a file inbound endpoint will, by default, remove the file from the source directory once it is read by the inbound endpoint. If you do not want to delete file automatically then you can set autoDelete property to false.

What is fileAge property in file connector in Mule ?

The fileAge property specifies how long the endpoint should wait before reading the file again. For instance, a fileAge of 60000 indicates Mule should wait a minute before processing the file again.

How to send only certain types of file from one directory to another in Mule ?

Use the below element in file inbound to filter certain types of files.

<file:filename-wildcard-filter pattern="file*.xml"/></file:inbound-endpoint>

pattern indicates what pattern of file names should move from one directory to another directory.

What is VM transport in Mule ?

The VM transport is a special kind of transport that you’ll use to send messages via memory. These messages never leave the JVM the Mule instance is running in.

What is multicasting router in Mule ?

The multicasting router can send messages to multiple endpoints over different transports. The multicasting router allows you to easily move the same messages across these different endpoints.

What is Mule transformer ?

It is an event, more specifically an instance of org.mule.api.MuleEvent. This object carries not only the actual content of the message but also the context of the event.

What is Mule context ?

The Mule context is composed of references to different objects, including security credentials, if any, the session in which the request is processed. All internals of the ESB are accessible through Mule context.

What is payload in Mule ?

The content of a message, also known as payload. It is wrapped in an instance of org.mule.api.MuleMessage, which provides different means of accessing the payload under different forms. A MuleMessage also contains properties, much like the header of a SOAP envelope or the properties of a JMS message, and can also have multiple named attachments.

What are different type of messages in Mule ?

Bridge messages — Pass messages from inbound to outbound routers.
Echo and log messages — Log messages and move them from inbound to outbound routers.
Build messages — Create messages from fixed or dynamic values.