Topic - 3 Debugging – File Connector –
Mule Event Model
Contents
Debugging a Mule Application
Connectors and Modules
File Connector
File Connector Configurations
Operations
Example – Poll For a new file and read its contents
Mule Event Model.
Message ( Payload – attributes)
Mule Event Model understanding - Using File Poller example
Debugging a Mule Application
Anypoint Studio Visual Debugger allows you to run your
application in Debug mode.
You can add breakpoints to processors and step through
the application.
- In Debug mode, application stops its execution when
debug point encounters.
- Watch event properties and values.
- Watch and evaluate Data Weave expressions.
By default, Debugger listens for incoming TCP connections
on local host port 6666.
More info :
Visual Debugger :
[Link]
Running a Project in debug mode
[Link]
Connectors & Modules
Modules :
- Modules are extensions to the Mule runtime that you can use when
building a Mule application ( Not to connect to external application)
- These are Mule inbuild , developed and supported by MuleSoft
- Example : Compression Module, Validation Module, Spring Module,
Aggregator Module
Connectors :
- These facilitate integrations with the third-party applications,
Databases.
- We use connectors to connect a Mule app to specific software
applications, databases, and protocols.
- Connectors abstract the technical details involved with
connecting to a target system.
- Example : File Connector, Database Connector, SFDC, SAP.
File Connector
There are 4 connectors available to work with files and folders.
- File
- FTP
- SFTP
- FTPS
All 4 connectors perform same kind of operations.
- On New Or Updated File : pools for a new/update file
- Read : to read file.
- Write : to write file.
- List : List the files and folders in given directory.
- Move : Moves the file from one location to other.
Using File Connector
Add File Connector to project.
Mule pallet > Add modules > Select File module > Drag drop on
Pallet.
To use File connector :
Create a Global configuration For File. ( Mule config
file -> Global elements > Create > Connector config
> File Config)
Mule pallet > File Connector > choose respective
operation, drag drop on canvas. ( specify its
properties)
> Example 1 : Poll for a New file and print the
contents in file.
> Example 2 : Send the file name from Http request
and read it from the mule process.
> Example 3 : Poll for a file and write the contents of a
file into a new file.
> All examples will cover Mule4 event model as well.