none
File adapter picks the file before file is completly written RRS feed

  • Question

  • Hi

     

    I'm using file adapter to pick files from different network shares. There is one network share that is special. It is located in another office and every time file adapter poll that share, it picks files before they are being completely written by an application. I did confirm that Biztalk host got full access rights on the share as MS recommends.

    So now I'm stuck. Anyone experienced similar issues?

     

    Kind regards

    A.H.

    Friday, June 3, 2011 8:31 AM

Answers

  • What version of Biztalk are you using? Are the files on a windows server or a UNIX server?

    I encountered this problem with BTS 2004 picking files up from a UNIX NTFS share because there are no windows events to detect the file is locked.

    I discovered that in BTS 2006? there was a new option on a receive file adapter called "rename file on reading". When I enabled this option the problem went away. I am not sure why this works but I was happy once I discovered this option.

    Thursday, June 9, 2011 12:40 AM
  • If the file is open/locked then it is not available to other applications.  

    Is the file locked while writing the file until the end? (lock + write to the end + release lock)

    Is the file being written in different appended parts (lock + write + release lock + lock again + write more + release lock etc)?

    Is this a Windows NTFS file share so locks and file system events work properly?

     

    Here are some information on how to lock file so it cannot be accessed by others:

    http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx
    dwShareMode [in]
    0x00000000  Prevents other processes from opening a file or device if they request delete, read, or write access.

    http://msdn.microsoft.com/en-us/library/aa363874(VS.85).aspx

    http://msdn.microsoft.com/en-us/library/system.io.filestream.lock.aspx

    Alternative may be to write the file to other name and then rename it when file is finished.

     

    If BizTalk is writing the file I would test with:

    http://msdn.microsoft.com/en-us/library/aa561308(BTS.70).aspx
    http://msdn.microsoft.com/en-us/library/aa578662(BTS.70).aspx
    Allow Cache on write = False
    Copy mode = Create New
    Use temporary file while writing = True

     

    Cheers
    Niklas


    Monday, June 6, 2011 12:40 AM
  • We solved the issue. The issue had actually nothing to do with BizTalk. The customer end-system had no sort of lock when creating files on the share-folder. BizTalk just picked them and tried to process them as normal.

    When working on projects involving other parties/companies you have no power over their systems and in this case they even accused BizTalk of wrongfully picking the locked , unfinished files. I guess BizTalk is used to be blamed for all the problems in an integration project.

    Thanks for all responses.

     

    • Marked as answer by Homer22 Wednesday, August 31, 2011 12:51 PM
    Wednesday, August 31, 2011 12:50 PM

All replies

  • Hi,

     

    I had a similar problem while working with BizTalk 2006. 

    So i had written a batch file for copying the file from one folder to another folder (which BizTalk pickup).

    Maybe it is work around.

    I don't have any idea if this problem is resolved in latest version i.e. 2009/2010.

     

    Thanks

    Sachin

     

    Friday, June 3, 2011 11:53 AM
  • If the application writing the file still has it locked, I would expect the file adapter to honor this lock, but maybe it doesn't.  I haven't run into this problem myself.

    Possible work-around: could you rename the file after it is written?  So if the application writes *.xml, have BizTalk look for *.xml_done.

    Friday, June 3, 2011 4:53 PM
  • Hi

     

    Thx for your reply, guys. I was thinking to implement solution where file is renamed but of course, the application that is writing the file to the folder does not have this option (its a third-party application).

     

    I was thinking that we are experiencing these problems because its a network share. I know that Biztalk will never pick read-only and system files. Do you know exactly what type of lock an application has to have when writing to a folder for Biztalk not pick it up?

     

    Kind regards

    A.H.

    Sunday, June 5, 2011 6:26 PM
  • If the file is open/locked then it is not available to other applications.  

    Is the file locked while writing the file until the end? (lock + write to the end + release lock)

    Is the file being written in different appended parts (lock + write + release lock + lock again + write more + release lock etc)?

    Is this a Windows NTFS file share so locks and file system events work properly?

     

    Here are some information on how to lock file so it cannot be accessed by others:

    http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx
    dwShareMode [in]
    0x00000000  Prevents other processes from opening a file or device if they request delete, read, or write access.

    http://msdn.microsoft.com/en-us/library/aa363874(VS.85).aspx

    http://msdn.microsoft.com/en-us/library/system.io.filestream.lock.aspx

    Alternative may be to write the file to other name and then rename it when file is finished.

     

    If BizTalk is writing the file I would test with:

    http://msdn.microsoft.com/en-us/library/aa561308(BTS.70).aspx
    http://msdn.microsoft.com/en-us/library/aa578662(BTS.70).aspx
    Allow Cache on write = False
    Copy mode = Create New
    Use temporary file while writing = True

     

    Cheers
    Niklas


    Monday, June 6, 2011 12:40 AM
  • Maybe you could first copy the file to a temp folder that is not monitored by the FILE adapter receive location. Once the file is completely copied over locally, you could move it to the folder from where BizTalk picks it up.
    ______ Nitin Mehrotra, BizTalk Server CCxG, http://blogs.msdn.com/nitinme/
    Wednesday, June 8, 2011 5:20 AM
  • What version of Biztalk are you using? Are the files on a windows server or a UNIX server?

    I encountered this problem with BTS 2004 picking files up from a UNIX NTFS share because there are no windows events to detect the file is locked.

    I discovered that in BTS 2006? there was a new option on a receive file adapter called "rename file on reading". When I enabled this option the problem went away. I am not sure why this works but I was happy once I discovered this option.

    Thursday, June 9, 2011 12:40 AM
  • We solved the issue. The issue had actually nothing to do with BizTalk. The customer end-system had no sort of lock when creating files on the share-folder. BizTalk just picked them and tried to process them as normal.

    When working on projects involving other parties/companies you have no power over their systems and in this case they even accused BizTalk of wrongfully picking the locked , unfinished files. I guess BizTalk is used to be blamed for all the problems in an integration project.

    Thanks for all responses.

     

    • Marked as answer by Homer22 Wednesday, August 31, 2011 12:51 PM
    Wednesday, August 31, 2011 12:50 PM