Tuesday, September 19, 2017

Getting Started with Logic Apps - File Routing

The very first thing which comes in mind when starting with any Integration tool is to do couple of demo
1. How to route file from one location to another (File Routing)

In this post I intend to explore the way Logic app can be used in a scenario where only routing of files is required, also brief comparison with BizTalk File Adapter and some points to be noted.

Prerequisite:
  1. Azure subscription
  2. On Premises Data gateway (If not done already then follow -Installing and Configuring On Premises Data Gateway - By adding user to Active Directory)
Let’s start with designing the workflow:-


Create instance of Logic App
  •   Login to https://portal.Azure.com
  •   Create instance of Logic app, click on new and select Logic App
  •   Provide Name, select subscription, resource group and Location.
  •   Then select Blank Template and search for File Trigger
  •   For now there are couple of triggers available against File System
create Logic App

  •   Select the trigger type you are interested in, I have selected “when one or more files are added or modified”

  • First thing after selecting trigger is to create a connection, here we use On Premises data gateway (Connect via on-premise data gateway), thus Demo data gateway gets auto populated as it is already installed on the machine. Provide rest of the connection information.
create connection

  • After creating a connection we need to provide the Folder information, which Logic Apps needs to watch for
configure trigger

get file content action

  • Second action is to create file from the content and save it to destination folder with the same name and for that add an Action, Create File
create file action

That’s it. Logic app to route file from one folder to another folder which is on Premises is ready.




Testing


  • Created one sample xml and one text file in IN folder and both were routed to OUT folder- Logic app was triggered

Trigger successful testcase


Note: The files are not deleted from IN folder (In BizTalk file adapter deletes the files, once it drops it in messagebox)


  • Modified the already existing file in IN folder and it was routed to OUT folder - the Logic app was triggered
  • When dropped already existing sample files nothing happened - the logic app wasn’t triggered(it was skipped)

Trigger skipped testcase


Note: It seems File System trigger looks at the timestamp as well- anything older than the Interval (where it looks for new or modified files) is ignored.

If there is any other way to implement this scenario in Logic apps, then would certainly love to hear from you.


Related Post


No comments:

Post a Comment