Mule file connector

21
Mule File Connector Thanh Nguyen

Transcript of Mule file connector

Page 1: Mule file connector

Mule File Connector

Thanh Nguyen

Page 2: Mule file connector

Introductions

• Allows your Mule application to exchange files with a file system

• You can implement the File connector as an inbound endpoint (such as, a message source), or as an outbound endpoint

• This endpoint implements a one-way exchange pattern only

Page 3: Mule file connector

Configuration

• File endpoint configuration consists of two stages:– Place the File endpoint within the Mule flow you

are developing– Configure the File endpoint by providing values for

the fields on the various tabs on the properties editor

Page 4: Mule file connector

Inbound endpoint

Page 5: Mule file connector

Inbound endpoint

• Configuration XML Default Representation• <file:inbound-endpoint path=""

responseTimeout="10000" doc:name="File"/>

• Properties Window Default View

Page 6: Mule file connector

Outbound endpoint

Page 7: Mule file connector

Outbound endpointProperty Description

Display Name Defaults to the generic endpoint name. Change the display name, which must be alpha-numeric, to reflect the endpoint’s specific role, such as Order Entry Endpoint

Path The target directory on the connected file system. If File is implemented as an inbound endpoint, this would be the location within the connected file system of the file being transferred into the flow. For an outbound File endpoint, this would be the directory on the connected file system to which the file currently in the flow is written.

Page 8: Mule file connector

Outbound endpointMove to Pattern (Applies to inbound File endpoints

only) . The pattern to be used when moving a file according to the Move to Directory property. It can use the patterns specified by the filename parser configured (often through a Connector template) for this particular File endpoint.

Move to Directory (Applies to inbound File endpoints only.) Typically, the file being received is simply read by the inbound endpoint and dispatched to the next building block in the flow. To save a copy on the Mule host machine, specify a path in this field.

Page 9: Mule file connector

Outbound endpointConnector Configuration Use the dropdown list to

select a previously created connector configuration for this endpoint. If you have not created a connector configuration for this type of endpoint, you can do so from this window by clicking Add . Click Edit to modify a previously created global element.

Polling Frequency (Applies to inbound File endpoints only.) Specify how often the endpoint should check for incoming messages. The default value is 1000 ms.

Page 10: Mule file connector

Outbound endpointFile Age (Applies to inbound File

endpoints only.) Sets a minimum period a file must wait before it is processed. This helps ensure that long files are received in their entirety before processing starts. However, Mule and the connected file system must be on synchronized time for this feature to work properly.

File Name Regex Filter (Applies to inbound File endpoints only.) Configure a filter to restrict the files being processed.

Page 11: Mule file connector

Outbound endpoint

File Name / Pattern (Applies to outbound File endpoint only). Specify a filename or pattern for naming files that are sent from the File endpoint to the connected file system. If not set, the File endpoint uses the same file-naming pattern used for incoming files

Page 12: Mule file connector

Advanced Tab

Page 13: Mule file connector

Advanced Tab

Property DescriptionAddress Enter the address for this

endpoint, such as http://localhost:8081/file.

Response Timeout Specify how long (in ms) the endpoint waits for a response from the connected file system.

Encoding Choose from a drop-down list the character set used for message data. (such as UTF-8).

Page 14: Mule file connector

Advanced TabDisable Transport Transformer

Check this box if you do not want to use the endpoint’s default response transport.

MIME Type Select from the dropdown list one of the formats this endpoint supports.

Connector Endpoint Use the dropdown list to select a previously configured global endpoint reference. If you have not created a global element for this type of endpoint, you can do so from this window by clicking Add. Click Edit to modify a previously created global element.

Page 15: Mule file connector

Advanced Tab

Comparator (Applies to inbound File endpoints only) . Specify the comparator used to sort incoming files, as in org.mule.transport.file.comparator. If you write your own comparator, it must implement the java.util.Comparator interface.

Page 16: Mule file connector

Reconnection Tab

Page 17: Mule file connector

Reconnection Tab

Page 18: Mule file connector

Transformers Tab

Page 19: Mule file connector

Transformers Tab

Property DescriptionTransformers References: Request

Enter a list of synchronous transformers that are applied to the request before it is sent to the transport.

Global TransformersANDTransformers to be applied

Reference the global transformers you desire. Enter a list of synchronous transformers that are applied to the response before it is returned from the transport and order them for your needs.

Page 20: Mule file connector

Transformers Tab

Page 21: Mule file connector

Question and answer