Beispiel #1
0
        public void RegisterWorkflow_OnRegister_UsesService()
        {
            // set up the store and the workflows
            IWorkflowStore workflowStore            = Substitute.For <IWorkflowStore>();
            IWorkflowRegistrationService regService = Substitute.For <IWorkflowRegistrationService>();

            BasicWorkflow   workflow       = new BasicWorkflow(BasicWorkflow.State.Start);
            IWorkflowServer workflowServer = new WorkflowServer(workflowStore, regService, Substitute.For <IWorkflowExceptionHandler>());

            workflowServer.RegisterWorkflow(workflow);

            regService.Received(1).RegisterWorkflow(workflowStore, workflow);
        }
        public void RegisterWorkflow_OnRegister_UsesService()
        {
            // set up the store and the workflows
            IWorkflowStore workflowStore = Substitute.For<IWorkflowStore>();
            IWorkflowRegistrationService regService = Substitute.For<IWorkflowRegistrationService>();

            BasicWorkflow workflow = new BasicWorkflow(BasicWorkflow.State.Start);
            IWorkflowServer workflowServer = new WorkflowServer(workflowStore, regService, Substitute.For<IWorkflowExceptionHandler>());
            workflowServer.RegisterWorkflow(workflow);

            regService.Received(1).RegisterWorkflow(workflowStore, workflow);

        }
Beispiel #3
0
        void WorkerThreadFunc()
        {
            // fire up the server, this will run as part of the service (you can set the workflow store here)
            IWorkflowStore workflowStore = BootStrapper.MongoDbStore();
            //IWorkflowStore workflowStore = BootStrapper.MemoryStore();
            //IWorkflowStore workflowStore = BootStrapper.RavenDbEmbeddedStore();

            IWorkflowServer workflowServer = new WorkflowServer(workflowStore);

            workflowServer.RegisterWorkflowType <FileCreationWorkflow>();

            // create a new example workflow if it hasn't been registered already
            FileCreationWorkflow workflow = new FileCreationWorkflow(FileCreationWorkflow.State.Start);

            workflow.RootFolder    = "C:\\Temp\\";
            workflow.ResumeTrigger = FileCreationWorkflow.Trigger.WriteFirstFile.ToString();
            workflow.Priority      = 5;
            workflowServer.RegisterWorkflow(workflow);

            while (!_shutdownEvent.WaitOne(0))
            {
                int executedCount = 0;

                try
                {
                    executedCount = workflowServer.ExecuteWorkflows(5);
                }
                catch (Exception)
                {
                    // do some logging!
                }

                // if no workflows were found, sleepy sleep - you should create an app setting for the poll
                // interval appropriate to you
                if (executedCount == 0)
                {
                    Thread.Sleep(1000);
                }
            }
        }
        void WorkerThreadFunc()
        {
            // fire up the server, this will run as part of the service (you can set the workflow store here)
            //IWorkflowStore workflowStore = BootStrapper.MongoDbStore();
            //IWorkflowStore workflowStore = BootStrapper.MemoryStore();
            IWorkflowStore workflowStore = BootStrapper.RavenDbEmbeddedStore();
            
            IWorkflowServer workflowServer = new WorkflowServer(workflowStore);
            workflowServer.RegisterWorkflowType<FileCreationWorkflow>();

            // create a new example workflow if it hasn't been registered already
            FileCreationWorkflow workflow = new FileCreationWorkflow(FileCreationWorkflow.State.Start);
            workflow.RootFolder = "C:\\Temp\\";
            workflow.ResumeTrigger = FileCreationWorkflow.Trigger.WriteFirstFile.ToString();
            workflowServer.RegisterWorkflow(workflow);


            while (!_shutdownEvent.WaitOne(0))
            {

                try
                {
                    workflowServer.ExecuteWorkflows(5);
                }
                catch (Exception)
                {
                    Thread.Sleep(1000);
                }

                // sleepy sleep
                Thread.Sleep(1000);
            }



        }