Documentation on Workflow Instance Store

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
kmoren
Posts: 11
Joined: Sat 07 Jan 2012 20:07

Using 6.60.28 But InstanceCompletionAction Error Still There

Post by kmoren » Sat 07 Jan 2012 20:17

Using a WCF Workflow Service project (xamlx) hosted by IIS and in the web.config, the configuration of the persistence and tracking behaviors is...

Code: Select all

<add name="oracleInstanceStore" type="Devart.Data.Oracle.DurableInstancing.Configuration.OracleInstanceStoreElement, Devart.Data.Oracle.WorkflowFoundation, Version=6.60.268.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
<add name="oracleTracking" type="Devart.Data.Oracle.ActivitiesTracking.OracleTrackingParticipant, Devart.Data.Oracle.WorkflowFoundation, Version=6.60.268.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</behaviorExtensions> 
and the actual behavior configuration is ...

Code: Select all

<oracleInstanceStore connectionString="<omitted>" instanceEncodingOption="GZip"
instanceLockedExceptionAction="AggressiveRetry" hostLockRenewalPeriod="00:00:30"
instanceCompletionAction="DeleteAll" runnableInstancesDetectionPeriod="00:00:05" />
<workflowIdle timeToPersist="0" timeToUnload="0"/>
<!-- Support workflow tracking -->
<oracleTracking profileName="nmdTrackingAll" connectionString="<omitted>"/> 
However, like others have reported for a few weeks, the persistence provider fails to initialize with the same error of ...

The default value for the property 'instanceCompletionAction' has different type than the one of the property itself.

When will this be fixed? It's urgent we be able to get this to work as using Oracle as our backing store is the only option and our workflow services can't progress until we have persistence.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 09 Jan 2012 16:25

As a workaround, please use another ways (not via *.config file) of configuring OracleInstanceStore. We are working on the problem.

kmoren
Posts: 11
Joined: Sat 07 Jan 2012 20:07

Documentation on Workflow Instance Store

Post by kmoren » Mon 09 Jan 2012 21:53

Since this is a WCF workflow service hosted in IIS, we don't have a non-config file option of enabling the extensions and behaviors for the instance store and tracking.

BTW, DevArt hasn't provided an ETA on the fix and for those that can't wait for a declarative approach but need to host in IIS or AppFabric, here is what we've done so far to circumvent this issue. We basically used file-less dynamic activation for our workflow services and each activation uses a thin custom workflow service host factory that allows us to get a host (from the base) and then via code add extensions, behaviors and the like, including the DevArt instance store and tracking.

Code: Select all

<add relativeAddress="~/WorkSpecV1.xamlx" service="WorkSpecV1.xamlx"  factory="NMD.Workflow.NMDWorkflowServiceHostFactory" />
</serviceActivations>
</serviceHostingEnvironment>        
      
 public class NMDWorkflowServiceHostFactory : System.ServiceModel.Activities.Activation.WorkflowServiceHostFactory
    {
        protected override System.ServiceModel.Activities.WorkflowServiceHost CreateWorkflowServiceHost(WorkflowService service, Uri[] baseAddresses)
        {
            System.ServiceModel.Activities.WorkflowServiceHost workflowServiceHost = base.CreateWorkflowServiceHost(service, baseAddresses);
         
            WorkflowRuntimeBehavior runtimeBehavior = workflowServiceHost.Description.Behaviors.Find();
            if (runtimeBehavior != null) CreateRunTimeEventHandlers(runtimeBehavior);
            AddBehaviorsAndEndpoints(workflowServiceHost);

            return workflowServiceHost;
        }
This holds promise for us and allows us to use IIS and configure the DevArt stuff via code. BTW, the tracking participant from DevArt doesn't have any support to my knowledge for config based extension / behavior addition. It must be code declared.

BTW, use AppFabric is possible for your host if you have any Delays (durable timers) in your code. AppFabric (and Sharepoint) have windows services that stay alive to poll for the timer expirations and activate the persisted workflows. With IIS, you need to write your own windows service or use global.asax to create your workflow service hosts (without end points most likely) to do this polling and loading of instances on timer expirations.
Last edited by kmoren on Thu 12 Jan 2012 15:24, edited 1 time in total.

cfuehrmann
Posts: 10
Joined: Tue 13 Dec 2011 13:20
Location: Erlangen, Germany

Re: Documentation on Workflow Instance Store

Post by cfuehrmann » Tue 10 Jan 2012 09:53

kmoren wrote:Since this is a WCF workflow service hosted in IIS, we don't have a non-config file option of enabling the extensions and behaviors for the instance store and tracking.
A colleague of mine may have found the reason for the bug and I just sent Shalex an email about it.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 13 Jan 2012 18:09

We are investigating the issue.

kmoren
Posts: 11
Joined: Sat 07 Jan 2012 20:07

LockOwnersTable

Post by kmoren » Mon 16 Jan 2012 21:54

We have this working when imperatively (code) configured as seen below with a in our configuration file. The only problem that remains is that when a workflow completes, it leaves a record in LockOwnersTable and the workflow service host polling simply keeps extending the expiration date and not removing the record.

Code: Select all

 host.Description.Behaviors.Add(new OracleInstanceStoreBehavior
            {
                ConnectionString = "...";
                InstanceEncodingOption = InstanceEncodingOption.GZip,
                InstanceCompletionAction = InstanceCompletionAction.DeleteAll,
                InstanceLockedExceptionAction = InstanceLockedExceptionAction.BasicRetry,
                HostLockRenewalPeriod = new TimeSpan(00, 00, 01), // seconds for host to extend lock lease else another host may gain lock to instance
                RunnableInstancesDetectionPeriod = new TimeSpan(00, 00, 15) // seconds (runnable being not suspended, unlocked and expired timer, unlocked and Executing status, or has expired lock - raises HasRunnableWorkflowEvent
            });

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 18 Jan 2012 16:22

The bug with enabling Persistence for WAS-hosted Workflow Services that use WorkflowServiceHost using a configuration file is fixed. We will post here when the corresponding build of dotConnect for Oracle is available for download.
kmoren wrote:The only problem that remains is that when a workflow completes, it leaves a record in LockOwnersTable and the workflow service host polling simply keeps extending the expiration date and not removing the record.
If OracleInstanceStore doesn't remove the record, there is no corresponding command to OracleInstanceStore from Workflow runtime.

kmoren
Posts: 11
Joined: Sat 07 Jan 2012 20:07

Post by kmoren » Thu 19 Jan 2012 21:13

Upon request we swapped out the DevArt instance store for the Microsoft sql version running in SQL Express (use Visual Studio for client management). The sql scripts are deployed with the framework in the framework 4.0 folder in sql/en.

We configured as follows ...

host.Description.Behaviors.Add(new SqlWorkflowInstanceStoreBehavior {
ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Oracle\development\Sprint2Application\NMD.Workflow\App_Data\InstanceStore.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True",
InstanceEncodingOption = System.Activities.DurableInstancing.InstanceEncodingOption.GZip,
InstanceCompletionAction = System.Activities.DurableInstancing.InstanceCompletionAction.DeleteAll,
InstanceLockedExceptionAction = System.Activities.DurableInstancing.InstanceLockedExceptionAction.BasicRetry,
HostLockRenewalPeriod = new TimeSpan(00, 00, 05), // seconds for host to extend lock lease else another host may gain lock to instance
RunnableInstancesDetectionPeriod = new TimeSpan(00, 00, 02) // seconds (runnable being not suspended, unlocked and expired timer, unlocked and Executing status, or has expired lock - raises HasRunnableWorkflowEvent
});


What we discovered is that with sql server instance store, it replaces the LockOwnersTable rows and when the host is running, if you run on the same machine all the time, you always have one row in this table but the Id, surrogateLockOwnerId and LockExpiration all increase with each replacement row. This is expected since you are running your workflows from the same machine each time. If it was a different machine (say in load balanced environment or due to server replacement), then you'd still have one row but the machine name would differ.

However, with the DevArt instance store, it doesn't seem to replace the rows in this table but simply appends new rows.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 20 Jan 2012 13:42

Our test with LockOwnersTable succeded. The record is marked as deleted (ExpirationDate = 01-01-2000) when host.Close() is called. After the application is launched again, the old record is removed and the new one is created.
Could you please send us a small test project to reproduce the issue in our environment?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 01 Feb 2012 11:37

We have updated our documentation concerning Workflow Foundation Support: http://www.devart.com/dotconnect/oracle ... pport.html.

cfuehrmann
Posts: 10
Joined: Tue 13 Dec 2011 13:20
Location: Erlangen, Germany

One more issue when hosting with a configuration file

Post by cfuehrmann » Fri 03 Feb 2012 09:08

The bug we mentioned in our last forum post has been fixed with
version 6.70.293 - thanks! Alas, we have found another issue where
hosting with a configuration file fails while hosting in code
works. We have a very simple workflow that consists of a
Receive/SendReply followed by a Delay activity. (The xamlx follows at
the end of the email, but you may just create it by yourselves with a
a small number of clicks. Alternatively, we could send you a tiny
solution file that contains it.)

Now on the one hand we host this workflow with by using the following code:

var serviceDefinition =
(WorkflowService)XamlServices.Load("Service1.xamlx");
var host = new WorkflowServiceHost(serviceDefinition, new Uri("http://localhost:8888/"));
host.Description.Behaviors.Add(new OracleInstanceStoreBehavior
{
ConnectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=re0482)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=spex)));User Id=rkl;Password=rkl",
InstanceEncodingOption = InstanceEncodingOption.None,
InstanceCompletionAction = InstanceCompletionAction.DeleteAll,
InstanceLockedExceptionAction = InstanceLockedExceptionAction.BasicRetry,
HostLockRenewalPeriod = new TimeSpan(00, 00, 30),
RunnableInstancesDetectionPeriod = new TimeSpan(00, 00, 05)
});

The resulting workflow instance behaves as expected: when called via
WCF, it works its way through the Delay activity and then quits. On
the other hand, we host the same workflow in the IIS with the
following configuration file:



In this second case, the workflow gets stuck in the Delay activity
forever. In both cases, the workflow invocation leads to a new entry
in the INSTANCESTABLE of the Oracle instance store. In the first case,
that entry is updated soon with new data in the formally empty colums
COMPLEXDATAPROPERTIES, METADATAPROPERTIES, and more. In the second
case, the INSTANCESTABLE entry is never updated again.

So apparently, workflow instances hosted with a configuration file
have the wrong database behavior, even though the DevArt backend is
essentially capable of correct execution.

Any ideas?

---

And here is our little workflow:

Code: Select all

<WorkflowService mc:Ignorable="sap" ConfigurationName="Service1" sap:VirtualizedContainerService.HintSize="307,428" Name="Service1" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/servicemodel" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:p="http://tempuri.org/" xmlns:p1="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:s4="clr-namespace:System;assembly=System.ServiceModel" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<p1:Sequence DisplayName="Sequential Service" sad:XamlDebuggerXmlReader.FileName="c:\dokumente und einstellungen\rkleinhempel\eigene dateien\visual studio 2010\Projects\OrackeTestWorkflowService\OrackeTestWorkflowService\Service1.xamlx" sap:VirtualizedContainerService.HintSize="277,398" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
<p1:Sequence.Variables>
<p1:Variable x:TypeArguments="CorrelationHandle" Name="handle" />
<p1:Variable x:TypeArguments="x:Int32" Name="data" />
<p1:Variable x:TypeArguments="x:String" Default="test" Name="test" />
</p1:Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Receive x:Name="__ReferenceID0" CanCreateInstance="True" DisplayName="ReceiveRequest" sap:VirtualizedContainerService.HintSize="255,86" OperationName="GetData" ServiceContractName="p:IService">
<Receive.CorrelationInitializers>
<RequestReplyCorrelationInitializer CorrelationHandle="[handle]" />
</Receive.CorrelationInitializers>
<ReceiveMessageContent>
<p1:OutArgument x:TypeArguments="x:Int32">[data]</p1:OutArgument>
</ReceiveMessageContent>
</Receive>
<SendReply Request="{x:Reference __ReferenceID0}" DisplayName="SendResponse" sap:VirtualizedContainerService.HintSize="255,86">
<SendMessageContent>
<p1:InArgument x:TypeArguments="x:String">[data.ToString()]</p1:InArgument>
</SendMessageContent>
</SendReply>
<p1:Delay Duration="[New TimeSpan(0, 4, 0)]" sap:VirtualizedContainerService.HintSize="255,22" />
</p1:Sequence>
</WorkflowService>

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 06 Feb 2012 11:35

Could you please send us a small test project so that we can reproduce the issue in our environment?

cfuehrmann
Posts: 10
Joined: Tue 13 Dec 2011 13:20
Location: Erlangen, Germany

Post by cfuehrmann » Mon 06 Feb 2012 12:07

Done.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 13 Feb 2012 16:03

Thank you for your test project. We are investigating the issue.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 16 Feb 2012 14:19

Beziel wrote:Are you planning to use also promoted properties feature in a future version of your instance store?
The promoted properties feature of Oracle Workflow Instance Store is implemented.
cfuehrmann wrote:In this second case, the workflow gets stuck in the Delay activity forever.
The bug with adding records in ServiceDeploymentsTable of Oracle Workflow Instance Store is fixed.

We will post here when the corresponding build of dotConnect for Oracle is available for download.

Post Reply