얼마 전에 프로젝트에서이 문제가 발생했습니다. 우리가 생각해 낸 해결책은 두 개의 런타임을 호스팅하는 것이 었습니다. 하나는 영속성 서비스이고 다른 하나는없는 것입니다. 지속성 서비스가없는 런타임에서 우리는 호스트가 시작될 때 자동으로 시작되는 이러한 종류의 "모니터링 워크 플로"를 실행하고있었습니다.
이
그것을 구현하는 방법입니다
첫째, 우리는 우리가 지속성 서비스를 설정하는 설정 파일을했다 :
<configuration>
<configSections>
<section name="RuntimeWithPersistence" type="System.Workflow.Runtime.Configuration.WorkflowRuntimeSection, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</configSections>
<RuntimeWithPersistence>
<CommonParameters/>
<Services>
<add type="System.Workflow.Runtime.Hosting.DefaultWorkflowSchedulerService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionString="[dbconnectionstring]" UnloadOnIdle="true"/>
</Services>
</RuntimeWithPersistence>
</configuration>
그리고 워크 플로 호스트 응용 프로그램 (절단 및 편집에,
하지만, 난 내가) 아이디어를 전달 생각 :
public class WorkflowHost
{
private WorkflowRuntime _runtime = null;
private WorkflowRuntime _nonPersistingRuntime = null;
private void SetupRuntime()
{
// create a new WorkflowRuntime that points out a config section
// defining a persistence service
_runtime = new WorkflowRuntime("RuntimeWithPersistence");
// set up additional services to use
_runtime.StartRuntime()
// create a new WorkflowRuntime that does not point out a config section
_nonPersistingRuntime = new WorkflowRuntime();
// set up additional services to use
_nonPersistingRuntime.StartRuntime()
// start monitoring workflows in the non persisting runtime
StartMonitoringWorkflows(_nonPersistingRuntime);
}
}
의견에 감사드립니다. 나는이 접근 방법을 사용하기 시작했으나 다른 문제에 대한 우아한 해결책을 찾고자한다. 모니터링은 이전에 해고 된 "트리거"를 알아야하기 때문에 다음에 다시하지 않는다. 그것은 그것을 본다. 그래서 모니터링 대상에서 지속성을 사용하려고 생각했기 때문에 이미 트리거 된 것을 무시하는 트리거 목록을 저장할 수 있습니다. 나는 그 아이디어가 마음에 들지만 그것을 더 철저하게 조사 할 것이다. – Chris
우리는 같은 생각을하고 있지만 런타임에 이미 워크 플로우의 지속 인스턴스가 있는지 여부를 확인하는 간단하고 안정적인 방법을 찾았습니다 (워크 플로우 세계에서 상대적인 초보자 였고 그 이후로 더 조사하지 않았습니다 ...) –