mulesoft file connector
TRANSCRIPT
MulesoftFile Connector
https://docs.mulesoft.com/mule-user-guide/v/3.8/file-connector
Kumar [email protected]
Agenda• Introduction• Installation and configuration• Inbound vs outbound endpoint• Reconnection Tab• Transformer Tab• Demo• Conclusion
AboutThe File connector 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.
Installation and configurationInstallation:You can install a connector in Anypoint Studio using the instructions in Installing a Connector from Anypoint Exchange.
Configuration:File endpoint configuration consists of two stages:1. Place the File endpoint within the Mule flow you are developing:
o If you place the File endpoint at the beginning of the flow, it acts as an inbound endpoint (such as, message source), triggering the flow whenever it receives an incoming file.
o If you place the File building block in the middle or at the end of the flow, it serves as an outbound endpoint, passing files to the connected file system.
2. Configure the File endpoint by providing values for the fields on the various tabs on the properties editor.
Inbound vs outbound endpointInbound endpoint
Configuration XML Default Representation<file:inbound-endpoint path="" responseTimeout="10000" doc:name="File"/>
Inbound vs outbound endpointOutbound endpoint
Configuration XML Default Representation<file:outbound-endpoint path="" responseTimeout="10000" doc:name="File"/>
ReconnectionBy default, there is no reconnection strategy implemented for you, but you may choose to configure reconnection on a set frequency (Standard Reconnection) or via Custom Reconnection strategy.
Continue…Step 3: Add logger just after it to see the operation in log:
Message: #['FILE_NAME- '+message.inboundProperties.originalFilename],#['FILE_SIZE- '+((message.inboundProperties.fileSize)/1024)+'KB']]
Continue…Now, we let’s start testing by running the application
Corresponding logger message in console:
Also the files from source directory has been moved to target location. Please verify the same.
ConclusionSo this way we have seen how file connector works as a powerful component in files movement within local file system.