Addressing the differences – Workflow Durability Services

 

The .NET 3.5 Framework introduces a new Workflow Durability Service along with the already existing durability (persistence) service. This started confusing people and even looking into the SDK Documentation for detailed information will not bring up too much satisfaction or clarity for the readers. That brief explanation tells only something like this:

Durable services are WCF services that persist their state information to a storage medium after an operation decorated with the DurableOperationAttribute has completed. The difference between durable services and a workflow service is that workflow services can be persisted in-between an operation invocation.

 

OK, let’s explain in a more appropriate fashion how these things relate to each other. First of all note, that Windows Workflow Foundation was originally released with an out-of-the-box durable service, which of-course still exists and there is absolutely no intention to replace it. That “old” durability service is available with .Net 3.0 and installing .Net 3.5 will not change the picture at all. So if you already familiar with the Workflow Foundation Persistence Services, the good news is, your learning efforts have been preserved and just keep using the service as ever.

The confusion evolves due to the reason, that the SDK documentation starts introducing the new durability service in the chapter related to Windows Workflow Foundation, at Windows Workflow Foundation Programming Guide, at Creating Workflow Services and Durable Services. This is not a failure; however in my opinion the more appropriate re-placement would be at the Windows Communication Foundation chapter.

Furthermore you have to know, that in .Net 3.5 the only Workflow Foundation feature extension is the long awaited marriage between the both Foundation pillars, WCF and WF. Workflow Enabled Services is the another popular buzzword. Roughly speaking starting with .Net 3.5 Workflow Services are exposable also as WCF Services (along with ASMX Web Services introduced in .Net 3.0). So this new union between WCF and WF disturbs somewhat the picture as these new topics now could be discussed either from the WF or the WCF point of view. This is also the truth concerning the new durability service which however has little to do with Workflows and addresses rather WCF needs. So the correct naming in order to keep things clearly separate are:

·         Windows Workflow Foundation Persistence Services (.NET 3.0)

·         Windows Communication Foundation Durability Services (.NET 3.5)

As you can see the new durability service affects only WCF Services. The new durability service fells into the realm of WCF Behaviors and is only available while the ServiceContract supports sessions (SessionMode enum is either Required or Allowed). Moreover in order to gain full benefits of the new durability service, you have to switch to one of the new context-bound bindings in order to allow the client interacting with that durability service. In the table below are listed a few bindings with such behaviors.

 

.NET 3.0 bindings (base)

.NET 3.5 context-bound bindings

basicHttpBinding

basicHttpContextBinding

wsHttpBinding

wsHttpContextBinding

netTcpBinding

netTcpContextBinding

Also keep in mind, that the assembly which has to be referenced in order to use the durability service is the System.WorkflowServices.dll contains namespace extensions both for System.Workflow and System.ServiceModel as well.

The durability service allows clients operating in a session mode to send the appropriate context information to the server and even if the server was recycled or restarted for any unexpected reason, just proceed at the very same check-point preserving the whole context. The server will load the appropriate context from the backend store and the client will not even notice, that there was a shortage in service operations. The same is true also for the client. If the client preserves its own context-id, even if it was shut down, after restarting and reading that locally preserved context-id, the communication can keep going using the very same context before the client shutdown.

For an example just look for the durable services sample code in the SDK, which you can find at .NET Framework\Samples\WCF Samples\Technology Samples\Basic Samples\Workflow Service.

 

Consequences:

  • While creating and implementing pure WCF (without any WF) and there is a need to rely on durability, then your application has to use the new durability services available up-to-now in .NET 3.5.
  • If however your WCF service is implemented via Workflow and the communication utilizes “Receive Activity” and “Send Activity” activities, the same durability could be achieved using the “old” workflow persistence services along with the new context-bound bindings.

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s