CustomInstanceStore QueryActivatableWorkflowsCommand

Answered CustomInstanceStore QueryActivatableWorkflowsCommand

  • 2012년 3월 2일 금요일 오후 1:59
     
     

    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?


    • 편집됨 Desert_Fox 2012년 3월 2일 금요일 오후 2:00
    •  

모든 응답

  • 2012년 3월 2일 금요일 오후 3:04
     
     

    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?


    • 편집됨 Desert_Fox 2012년 3월 2일 금요일 오후 3:05
    •  
  • 2012년 3월 7일 수요일 오전 11:32
     
     답변됨

    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.

    • 답변으로 표시됨 LeoTangModerator 2012년 3월 11일 일요일 오전 7:57
    •