File delivery assurance in orchestrations

It has been a while since my last post, but I ran into something that I think is worth sharing with you.

At the moment I’m working on a BizTalk project which has the requirement that it should be able to handle large messages. That is up to a Gb or more.

For the business process I needed an orchestration. In the orchestration I move the message from the receive location to a share on another server using a send port. After that I call a web service which is responsible for transferring the message to a remote server using a XCOM server (this is a CA product).

For small messages everything worked fine, but the moment I tried a large message (say over 100 Mb) I found out that the file was not completely written to the fileshare before the web service was called. Obviously that call resulted in an error. The send port worked according to a kind of fire-and-forget mechanism so the orchestration moved on while the message transfer was still busy.

So I had to think of something to make sure the message was completely on the share before moving on down the orchestration. The first thing I thought of was using an ACK. I never looked at this before, but it sounded like something I could use. While using Google to find some samples about using the ACK I ran into the solution (thanks to Matt Milner) that is as simple as obvious: put the send shape in a transaction and the orchestration will wait until it is finished.

The actual steps are:

  • put the send shape in a scope
  • set the transactional properties to long running
  • set the Delivery Notification of the port to Transmitted
  • if necessary you can catch the DeliveryNotificationException

It is a very simple solution and it works great!