Search This Blog

Monday, 31 July 2017

5). Moving Files From FolderA(In) To FolderB(Out) just by using BizTalk Admin Console(Visual Studio is not required for this)

Open Run Command and type “BTSMMCLauncher.exe” to Open BizTalk Admin Console or you can open from installed programs.
Expand BizTalk Server Administration Tree nodeà Expand BizTalk Group NodeàExpand Applications Node
We should see the application (BizTalk_Tutorials) that we have deployed in the previous article in the application list.
Expand BizTalk_Tutorials application node and you should see all the artefact nodes.

Creating Receive Port, Receive Location and configure FILE Receive Location:-

Receive Port: - Receive Port is a Logical container of one or more receive locations. Receive location is the physical one that really connects to the external system. When the Receive location

Right click on Receive Ports node à Newà One-Way Receive Port
In the Name Textbox give the name to Receive Port as rcv_PurchaseOrders

Note: - We are creating this receive port to receive files from a folder location. The location can be on the Server where BizTalk is installed or the network share location.

Click on Receive Locations Tab on Receive Ports window.
Click on New Button to create a new receive location and in the Name Textbox of Receive location (RL) window give the name as rcv_FILE_PurchaseOrders.
In the Type Dropdown select FILE and Click the Configure Button to Configure our receive location.
In the Receive Folder textbox we need to enter the folder location where we will be receiving the files from. In our Example I have I have following location C:\Tutorials\In\

File Mask: - This is very important filed that we need to configure on RL. It we only want to process files with certain file extension then we specify here.  
Example: - If we want to process only xml files then the mask is *.xml
If we want to process only csv files then the mask is *.csv
If we want to process all types of files then the file mask is *.*
In My example I am dealing with .txt files so I am using *.txt in File Mask.

We are done with Receive Port and Receive Location configuration.

Creating Send port and configuring:-

Send Port (SP): - Send Port is the responsible artifact to subscribe to the messages that are been published to Message Box by the Receive Port. SP subscribes to the messages by using something called SP Filters.  The most commonly used Filters are BTS.MessageType, BTS.ReceivePortName.

RC on Send PortsàNewàStatic One-Way Send Portà
Name the SP as snd_PurchaseOrders à Select FILE in the Transport Type drop downà Click on Configure Buttonà

In the FILE Transport Properties window that opensà set the Destination Folder to C:\Tutorials\Out\ and the File name to %SourceFileName% 

Click on Filters tabà  in the middle of the screen click underneath the Property column and add the BTS.ReceivePortName Context Property and in the value field add the Name of the Receive Port that we have created which is rcv_PurchaseOrders


Note: - By creating filter on Send port we have created subscription on send port. By adding this filter, what we telling send port is that, All the messages that are been published from rcv_PurchaseOrders receive port are subscribed by the snd_PurchaseOrders send port. And sent to the destination folder (C:\Tutorials\Out\) configured on Send port.

Now if you drop any .txt files in the input(C:\Tutorials\In\) folder then the files should appear in the output(C:\Tutorials\Out\) folder.

I know if you have followed just all the steps that i have discussed the files will still be there in the input location. The reason for this is the Receive Location, Send Port are not started yet. Once you start them in right sequence then the files wll be moved to output folder.

Note:- First we need to start Send Ports then only receive ports the reason being, if you start the receive location first; BizTalk can't find the active subscribers at that point in time so it will suspend the messages with the below error.

The published message could not be routed because no subscribers were found. This error occurs if the subscribing orchestration or send port has not been enlisted, or if some of the message properties necessary for subscription evaluation have not been promoted. Please use the Biztalk Administration console to troubleshoot this failure. 

Acronyms used in the article:-

(RC): Right Click
(RL): Receive location
(SP):  Send Port

No comments:

Post a Comment

Sending Email to Multiple recipients using PowerShell

Hi All,  Below is the working code to Send emails to Multiple recipients using PowerShell. [STRING]$PSEmailServer = "YourSMTPServerIPOr...