Search code examples
biztalkbiztalk-orchestrations

Wait for an ACK file


I have a request to execute an orch only when a particular file is present, so for example:

  1. My customer will load several XML files.
  2. After all XML files were loaded, an special file called "OK.CTRL" will be created by them to point out that the XML filecopy finished.
  3. My orch should be listening on a receive port for this "OK.CTRL" file creation. When exists then it should start processing all the XML files.

I've been trying to do it in several ways:

  1. With 2 receive ports, the first as activated and the second not, but then I got an error: "you must specify at least one already-initialized correlation set for a non-activation receive that is on a non-selfcorrelating port".
  2. Same as 1, but with both on activated, and then there's another error: "an activatable receive must be the first executable statement in a service".
  3. Using a correlating set, but then the error "in a sequential convoy the ports must be identical", but I need 2 different ports, since file mask are different.

I tried as well with several combinations, but the results are always one of the 3 stated above.

Any ideas on how can I get it to work?


Solution

  • Why not simply have just one receive port on the orchestration (activating receive) that listens for the OK.CTRL message (file mask on receive location).

    Then inside the orchestration use C# to access the file system and load the files you need.

    However I would probably solve this using SQL Server tables and stored procedures. Then simply store each message into a table and have a stored procedure you can poll from BizTalk that returns true when the OK.CTRL is received into the table. Then BizTalk can extract all messages and forward them. The benefit to this approach is that you do not need orchestration at all.