cdpenndev

I have a BizTalk orchestration that uses a file adapter to monitor a directory, pick up a .wav file, rename it, build e-mail body/subject, attach the .wav file and send it to an imaging solution via e-mail and also place a copy of the .wav file in a backup directory. The BizTalk solution works like a charm when manually dropping files into the Receive Location.

The problem is that the .wav files are created through third-party digital recording software that attempts to reopen the file immediately after completing the save, resulting in an error for the end user because BizTalk has already deleted the file from the directory.

I have looked at the possibility of using a convoy, however, since the file is still deleted, there's the chance that it may not be back in place in time for the recording software to reopen it.

Is there any way to delay the file deletion from the Receive Location (i.e. file creation timestamp + 5 minutes)

Thanks!

Cathy



Re: BizTalk R2 General Delaying file deletion with file adapter

SaravanaKumar_1977

Hi,

You can customize the pooling interval times according to your requirement. Still I don't think it will solve the issue. Because the biztalk is pooling for a particular location for a particular file. I couldn't catch why the file is reopned from the same place. They can write the file in two place one for biztalk subscription and another one for their backup/reopen purpose.

Thanks,

Saravana Kumar





Re: BizTalk R2 General Delaying file deletion with file adapter

cdpenndev

Hi,

Thanks for the suggestion - I had thought of increasing the polling interval as well, however, my understanding is that it's based on actual time, not the file creation time. If it is based on the file creation time, then I believe that it would address my issue since the reopen by the recording software is instantaneous.

Unfortunately, the reopen is out of our control. The third party software automatically performs the reopen as part of the file save process (which is why it's reopening the file from the same place) and doesn't have any settings to allow us to override it reopening the file. The file path is also locked down in the application settings during installation (at our business client's request to ensure that files won't get lost by someone not choosing the correct directory) which also limits us to only being able to have the .wav file saved in a single directory. I walked through a scenario of using a simple FileSystemWatcher .NET app to copy the .wav file to a separate directory for BizTalk (and even possibly using it as the solution), however, again, the third party software is doing something odd behind the scenes during the save because the file watcher app isn't able to pick up the events (create, changed or renamed) and recognize that a new file has been placed in the directory.





Re: BizTalk R2 General Delaying file deletion with file adapter

SaravanaKumar_1977

I don't think the biztalk server file adapter solve your requirements. As soon as the third party components writes the file, the BizTalk pickes up, if the same file tries to open by the third party s/w it is failing. I hope this is what your issue, please correct me if I am wrong. In order solve this issue, whatever you done is correct approach, the I hope the filewatcher is a windows service component. To solve this issue, from the file watcher you can implement the following logics,

1. Check the time difference between file writing and file opening of that third party s/w (delta time). From the file watcher pickup the files only created after (current time - delta time).

2. Put one more logic in the file watcher check whether that file is in use while picking, if it is in use don't pick up. You can do this checking using file object of system.io.

I hope this solves the issue.

Thanks,

Saravana Kumar





Re: BizTalk R2 General Delaying file deletion with file adapter

cdpenndev

I am re-coding the file watcher app as a service to see if running it as a service makes any difference in its ability to recognize the file being placed in the directory (it was previously running as a console app due to the amount of work done behind the scenes for file handling).

If that still fails to see the files being placed in the directory, is there any possibility that a custom BizTalk adapter would possibly expose properties that would allow me to delay the file being deleted from the directory

Thanks,

Cathy





Re: BizTalk R2 General Delaying file deletion with file adapter

SaravanaKumar_1977

The bottom line is whatever logic that you are going to put in the windows service, the same you are going to write in BizTalk Adapter framework. Follow the suggesstion that I am given in my previous comments and let me know whehter it solves the issue or not.

Thanks,

Saravana Kumar





Re: BizTalk R2 General Delaying file deletion with file adapter

Leonid Ganeline - MVP

Saravana previously mentioned this.
You can use two step process.
1. BiZTalk picks up (publish) the files (and store them to the Message Box)
2. 1. BizTalk get the files and store them to the second folder
2. Your app picks up the files from this second folder etc. (and then delete them)





Re: BizTalk R2 General Delaying file deletion with file adapter

Karahan Celikel - MSFT

Can't you use a custom receive pipeline component in your file receive location that will introduce a delay based on the file creation time As long as the message is in the pipeline, the file will not get deleted. You can use the FileCreationTime context property when determining the wait time.

-Karahan





Re: BizTalk R2 General Delaying file deletion with file adapter

Karahan Celikel - MSFT

As a side note, I also would like to clarify the PollingInterval property. It's actually used for non-Windows systems where file system notification services is not avaiable. In Windows systems, files are picked up immediately.