0

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?

5
  • Is there an element in both the original XML files and the ACK file that contains a value unique to each batch? Otherwise what you are trying is not easily achieved. What you will probably have to do is just have the Orchestration listen for the ACK file. And then have a loop in the Orchestration call a helper class that looks for the XML files in the folder, and pick them up and process them one by one.
    – Dijkgraaf
    Commented Jan 7, 2020 at 21:27
  • Hi @Dijkgraaf, thanks for your help. No, there are no elements in common, mostly because the OK.CTRL file is empty. But I'll take a look to the helper class, in order to create a dynamic receive location.
    – AkerbeltZ
    Commented Jan 8, 2020 at 20:16
  • The helper class wouldn't need a dynamic receive location, it would just pick up files directly. Otherwise you will still have to same issue. Mikael's solution of just inserting the files into a database, and having a Receive Location that polls until the ACK file is received is probably easier, and doesn't require any custom code, just a database with a table.
    – Dijkgraaf
    Commented Jan 8, 2020 at 22:52
  • To go against the grain a little bit, I would have done this by having a receive location to consume the ok.ctrl file and a receive location tied to the orchestration for processing the xml, both disabled. I would have used powershell to run a script every x minutes to listen for the ok.ctrl file, if found, turn on the location for processing the XML files, followed by the location to consume the ok.ctrl file, then turn both off after a few seconds - A fairly simple solution.
    – Arx
    Commented Jan 16, 2020 at 15:05
  • Rough principles for this can be found here stackoverflow.com/a/54179810/1783921, should be able to find anything else regarding powershell scripting using your favourite search engine..
    – Arx
    Commented Jan 16, 2020 at 15:09

2 Answers 2

3

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.

0

You could still go with the sequential convoy using the same port but different receive locations. Then decide on the action within the orchestration based on the message type.

What you're doing with the XML files afterwards may be the deciding factor of which method you should take.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.