none
CustomInstanceStore QueryActivatableWorkflowsCommand

    Question

  • I'm currently writing my own Custom Workflow InstanceStore for a WorkflowServiceHost, I found this sample how to implement a Custom InstanceStore:

    http://blogical.se/blogs/mikael/archive/2011/02/01/using-appfabric-cache-as-wf-persistence-store.aspx

    My problem is now that I also want to load the persisted Workflows on startup and use timers. Is there any documentation or samples about that?

    As far as I've come (using ILSpy on SqlWorkflowInstanceStore) I have to create a timer which perodically checks for runnable instances and call InstanceStore.SignalEvent to raise a QueryActivatableWorkflowsCommand  but when I call that method my application crashes (in Debugger) after the command call is finished without a AppDomain.UnhandledException.

    Have anybody experience with building a complete Custom InstanceStore?


    • Edited by Desert_Fox Friday, March 02, 2012 2:00 PM
    Friday, March 02, 2012 1:59 PM

Answers

  • I managed to make the workflows getting loaded but I have following problem with restarting a workflow host:

    When I load a persisted workflow and call a correlated operation after the LoadWorkflowByInstanceKeyCommand the workflow gets aborted but imidatly resumed again (I noticed this because I use the tracking parcipiant).

    This only happens when I load the workflow using TryLoadRunnableWorkflowCommand. When start a new workflow and call the correlated operation this does not happen.

    Wednesday, March 07, 2012 11:32 AM

All replies

  • Ok my problem was that on a seperate thread (Catched by the Visual Studio test Application) I got the exception that the event is unknown. I've done some googling and found this microsoft code:

    By some random googling I found the following .NET framework source code:

                   if (currentEvent.Name == HasRunnableWorkflowEvent.Value.Name)
                    {
                        try
                        {
                            IAsyncResult result = this.instanceManager.BeginGetInstance(Guid.Empty, null, this.instanceManager.Host.PersistTimeout,
                                PrepareAsyncCompletion(handleEndGetInstance), this);
                            return SyncContinue(result);
                        }
                        catch (Exception exception)
                        {
                            if (Fx.IsFatal(exception) || !this.instanceManager.HandleException(exception))
                            {
                                throw;
                            }
                        }
                    }
                    else
                    {
                        Fx.AssertAndThrow("Unknown InstancePersistenceEvent (" + currentEvent.Name + ")!");

                    }

    Means raising a HasActivatableWorkflowEvent was the wrong idea.

    But still, has there anybody made already expiriences writing a custom instance wit loading persisted workflows?


    • Edited by Desert_Fox Friday, March 02, 2012 3:05 PM
    Friday, March 02, 2012 3:04 PM
  • I managed to make the workflows getting loaded but I have following problem with restarting a workflow host:

    When I load a persisted workflow and call a correlated operation after the LoadWorkflowByInstanceKeyCommand the workflow gets aborted but imidatly resumed again (I noticed this because I use the tracking parcipiant).

    This only happens when I load the workflow using TryLoadRunnableWorkflowCommand. When start a new workflow and call the correlated operation this does not happen.

    Wednesday, March 07, 2012 11:32 AM