BizTalk Server: Sending Missing File Alert


Scenario

There’s a requirement where we have to send a notification when messages are missing or expected business behavior is not achieved. By far the most common scenario from BizTalk side is when a file doesn’t appear at the expected location. Now this notification can be email or sms notification depending on the requirement. There are multiple ways to implement this scenario. I am just putting one from them.

So here's my case : My client do business with many vendor and each vendor sends file to my client on a specific time (SLA) and some time they miss to send the file so now my client need to notify them as when they not send file for the day.


Concept

We can implement this by two ways , we will cover both way here 

First way : create a table to keep log of the incoming file details means just make an entry as soon as you receive a file from the vendor for the day and we will use this tale to detect the missing file.

Second way : Generally we keep a archive copy of received message/file.  We can use this archive folder to detect the missing file .


Here we go

We need a table to keep the time (SLA) for each vendor file time. Like below:

Vendor TimeStart   EndTime  ReceivedDate NotificationSent

Vendor column will hold the vendor's name , Start Time and End Time hold the SLA for the file, Received Date is date of receiving file, NotificationSent is bit type, which indicates whether we already sent an e-mail or not (basically to avoid multiple notification for a day).

Now we need a stored procedure to get the name of vendor based on their SLA. It will be simple which will return the vendor name in the xml format if that's vendor endtime is less than the current time, from here will get the Vendor name.

Consume the message received from stored procedure and read the vendor name, and now time to implement our way which we mention earlier in this post, don't forget to make the NotificationSent flat to set 1 so in next time in the same day we will not consider this vendor again. As date changed reset all notificationSent Flag value to 0.

First way: now we have vendor name, look the File Log table to check whether that tale has any entry for that day/time for selected vendor , if yes then we are good . If no it means we not received file from the vendor for that day, need to notify.

Second way: now we have vendor name, look the Archive folder to check whether folder has any file for the day, if yes then we are good, if not means not received the file for that, need to notify the vendor.


Implementation

 

 

We are dealing here with different vendor's so their email will also different , we can store this email is in the form of Policy in BRE or SSO config.


Another important place to find a huge amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki