Freigeben über


Transactional behavior in a receive location using an adapter

Quite a few customers developing custom adapters built on the WCF LOB Adapter SDK have come back to us asking for details on how to have transactional behavior while receiving messages from the LOB and submitting them to BizTalk (receive location) - for example, assume in your receive location:

  1. You read some data from the LOB
  2. You delete the data from the LOB (since you don't want to read it again)
  3. In IInboundHandler, you construct a message containing this data
  4. You return this message via the out parameter in the TryReceive function (in other words, you are submitting this message into BizTalk).

If an error occurs after step 4, you have lost the data! (since it has already been deleted from the LOB).

If your LOB supports transactions, then you can prevent this from happening - the same transaction can be used to read + delete the data from the LOB, as well as submit the message into BizTalk, and if anything fails at any point, everything is rolled back.

More information on how you can do this - read this post by Sonu Arora at https://blogs.msdn.com/sonuarora/archive/2007/06/19/transaction-support-in-inbound-message-exchange-handler.aspx.