Is there any way to add persistent points within a BizTalk Orchestration flow using .NET code? I have searched and searched but haven't been able to find anything helpful. Help please, anyone?
-
2Just wrap your code in an atomic scope. – tom redfern Feb 19 '16 at 08:43
-
Do you mean calling the function inside an expression shape and place that expression inside an atomic scope? Wouldn't that point the persistence to the end of that scope? – noobmaster007 Feb 19 '16 at 09:45
-
I have answered in more detail. – tom redfern Feb 19 '16 at 09:56
1 Answers
Wrapping you code in an atomic scope will create a persitence point as soon as the scope is encountered.
This is why its generally considered bad practise to use atomic scopes, unless you really need them, because persistence is a cost and introduces complexity.
In an ideal world your orchestration would be designed to be idempotent so that there is no need for persistence - your orchestration gets loaded once and then stays in memory until it's finished (baring dehydration).
If the orchestration fails it should be replayable as a whole unit. However, that is not always possible, hence the need for persistence points.
but I guess it's bad practice..?
I would classify creating the requirement for persistence within a long running process as sometimes unavoidable bad design.
Imagine as part of your business process you have to make a call to an external resource which has an API which is not idempotent. A good example would be a web service which expects calls to arrive in a certain order. In this case you are forced to persist the state of your business process before and after the service call, otherwise you risk calling the service again with stale or otherwise incorrect call data if your process suffers a failure and then resumes. If the service call itself fails you would also be forced to write complex compensation logic to determine whether it was safe to call the service again.

- 30,562
- 14
- 91
- 126
-
That did the trick! Although, in some places wrapping the code in a scope did not work. Had to leave the call expression outside of an atomic, serializable scope in order to create a persistence point. Got the work done but I guess it's bad practice..? – noobmaster007 Mar 03 '16 at 09:42