Skip to content

Workflow hosting

Gurmit Teotia edited this page Jan 14, 2018 · 12 revisions

You can host the workflows using Guflow.Decider.WorkflowHost class. Following example shows how to host TranscodeWorkflow

var domain = //initialized domain
using(var host = domain.Host(new[]{new TranscodeWorkflow()})
{
   host.StartExecution();
   Console.WriteLine("Press a key to terminate the host");
   Console.ReadKey();
}

Hosting concept is very much specific to Guflow and not to Amazon SWF. When you start the workflow host it goes in execution loop and it executes following steps:

  • Poll for new decision tasks on Amazon SWF
  • Execute the returned decisions tasks against correct workflow
  • Send the workflow response back to Amazon SWF

In above example WorkflowHosts will poll for new decisions task on "DefaultTaskList" which is provided on WorkflowDescriptionAttribute, however you can specify the different task list to poll on by using other overload method:

var domain = //initialized domain
using(var host = domain.Host(new []{new TranscodeWorkflow()})
{
   host.StartExecution(new TaskQueue("some-queuename"));
   Console.WriteLine("Press a key to terminate the host");
   Console.ReadKey();
}

Please look at error handling section on handling the hosted related exceptions.

Clone this wiki locally