Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Mulesoft 4.0 BETA (File to File Transfers)

DZone's Guide to

Mulesoft 4.0 BETA (File to File Transfers)

Read this article in order to view a tutorial on how to use Mule 4.0 BETA.

· Integration Zone ·
Free Resource
CRM integration has become the cornerstone to meeting initiatives across organizations. Explore the top 6 value-driven Salesforce CRM integrations ebook.  

The new feature invoked in 4.0 BETA version for File Connector is quite different and enhanced as compared to the File Connector used in earlier versions of Anypoint Studio.

Step 1: Create a New Mule Project as Shown Namely as File2File

  • Drag and drop an HTTP listener Connector to get a request for your servers and give the host and port numbers. Here, the host is set to: mule4.eaiesb.com and port to 8087 and test your connection to check if the port is in use or not and test it successfully.
  • Set the path to: /File2File and set a successful response message. Here, setting File Transferred Successfully.
  • By default, Mule 4.0 do not have File Module so use Palette to add it.

Step 2: Click on Add Module and Select File to Add Extension 

  • Earlier Mule version has only one file connector which can be used for both inbound and outbound operations based on its position but new version supports different operations as shown :

Image title

  • Drag the connector and give the path for the working directory. Make sure to test the connection successfully and give the name of the input file as shown:Image title

Step 3: Drag a Logger to Print Payload in Console. 

Step 4: Drag a File Write Operation to Process the Successful Write Operation 

  • Set the path for output working directory and test the connection. Make sure to give the File Name.

The complete flow is shown below:

Image title

Step 5: Run the Mule Project: 

By default, Mule will download all the artifacts from the maven repository and once the project does not have errors, it will show a successful deployment.

Step 6: Verify the Input and Output Locations File: 

The output file is not yet created, as operations have to be processed.

Step 7: Open the Postman and Hit the Service Url Request as Shown: 

Image title

File transfers successfully from input to output location as seen in success message. Verify the operation in the output directory set for write operation and verify the payload in the console as shown:

Image title

Happy Learning!

Sync, automate, and notify lead to customer changes across marketing, CRM, and messaging apps in real-time with the Cloud Elements eventing framework. Learn more.

Topics:
mule 4 ,integration ,tutorial ,mulesoft

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}