Mule

How to prevent automatic file deletion from the source directory?

By default the file gets deleted automatically once the file is read from the source directory. Therefore if your file needs to be read in subsequent requests then you can set autoDelete property to false(by default, it is true).

<file:connector name="" autoDelete="false"/>

How to read only a particular file from a directory?

If you do not specify which file Mule needs to read from a source directory, Mule will read all files from the source directory. So if you want Mule to read only a particular file from the source directory then specify the file name as shown below

<file:inbound-endpoint path="..." doc:name="File">
	<file:filename-wildcard-filter pattern="catalog.xml" />
</file:inbound-endpoint>

where catalog.xml is the file name you want Mule to read from the given “path”.

How to read files having some pattern in the name?

<file:inbound-endpoint path="..." doc:name="File">
	<file:filename-wildcard-filter pattern="*catalog.xml" />
</file:inbound-endpoint>

So any filename that ends with catalog.xml will be read from the given “path’.

How to move file with original filename from source to destination directory?

Specify outputPattern attribute in file outbound endpoint with function originalFilename.

<file:outbound-endpoint path="..." outputPattern="#[message.inboundProperties.originalFilename]" doc:name="File"/>

How to move files from source to destination directory having some pattern in filename?

For example, move all files whose names starts with SNAPSHOT and ends with .xml extension

<file:outbound-endpoint path="..." moveToPattern="SNAPSHOT*.xml" doc:name="File"/>

How many types of message exchange an endpoint does support?

There are two types of message exchanges supported by an endpoint in Mule ESB.

Asynchronous: if you think the message you are sending does not require any reply or reply does not matter to you then you can send the message in asynchronous way. An example would be a JMS message you place on a queue.

Synchronous: if the response is important then you declare an endpoint to be declared as synchronous.

Does Mule implement JMS server?

Mule does not implement JMS server; so we need to use the JMS transport in conjunction with a JMS implementation such as ActiveMQ, OpenMQ or Tibco EMS.

What transformer does Mule use when no transformer is defined in JMS?

Mule will implicitly use the JMS message-to-object transformer when no other transformers are present.

What is VM transport?

The VM transport is a special kind of transport that is used to send a message via memory, that is, a message is sent through services internal to a Mule instance before routing it to a final endpoint or service. The VM transport allows to leverage the virtues of an asynchronous messaging framework such as JMS without the overhead of a broker.

What is filter?

Filtering is an important facet of routing in Mule. Many routers take filters as an argument that defines or augments their behavior. For example, we configure a regex filter to selectively consume messages whose payloads match the supplied regular expression.

How many ways filter can be configured?

The filter can be configured in the following ways.
Filtering by type:

<payload-type-filter expectedType="com.roytuts.model.Product"/>

The above example says how to restrict consumption to messages with a com.roytuts.model.Product payload.

Filtering by textual context: For example, consume the message that contains the string “SUCCESS” in the payload.

<wilcard-filter pattern="*SUCCESS*"/>

Filtering with expressions: For example, filter data based on status “SUCCESS” for the below XML payload.

<product>
    <productId>1102</productId>
    <productName>Mule ESB</productName>
    <status>SUCCESS</status>
</product>
<expression-filter evaluator="jxpath" expression="(product/status)='SUCCESS'"/>

Other than JXPath evaluator can be specified to let it evaluate the expression.
Logical filtering: this lets you perform boolean operations using two or more filters.

How to remove property from Mule flow?

Removing properties that you don’t need is a common operation.