static void Main() { // Same workflow as Dataflow sample Activity workflow = LoadProgram("Dataflow.xaml"); WorkflowServiceHost host = new WorkflowServiceHost(workflow, new Uri("http://localhost/Dataflow.xaml")); WorkflowControlEndpoint controlEndpoint = new WorkflowControlEndpoint( new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml"))); CreationEndpoint creationEndpoint = new CreationEndpoint( new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml/Creation"))); host.AddServiceEndpoint(controlEndpoint); host.AddServiceEndpoint(creationEndpoint); host.Open(); Console.WriteLine("Host open..."); IWorkflowCreation creationClient = new ChannelFactory <IWorkflowCreation>(creationEndpoint.Binding, creationEndpoint.Address).CreateChannel(); // Start a new instance of the workflow Guid instanceId = creationClient.CreateSuspended(null); WorkflowControlClient controlClient = new WorkflowControlClient(controlEndpoint); controlClient.Unsuspend(instanceId); Console.WriteLine("Hit any key to exit Host..."); Console.ReadLine(); }
static void Main() { // Same workflow as Dataflow sample Activity workflow = LoadProgram("Dataflow.xaml"); WorkflowServiceHost host = new WorkflowServiceHost(workflow, new Uri("http://localhost/Dataflow.xaml")); WorkflowControlEndpoint controlEndpoint = new WorkflowControlEndpoint( new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml"))); CreationEndpoint creationEndpoint = new CreationEndpoint( new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml/Creation"))); host.AddServiceEndpoint(controlEndpoint); host.AddServiceEndpoint(creationEndpoint); host.Open(); Console.WriteLine("Host open..."); IWorkflowCreation creationClient = new ChannelFactory<IWorkflowCreation>(creationEndpoint.Binding, creationEndpoint.Address).CreateChannel(); // Start a new instance of the workflow Guid instanceId = creationClient.CreateSuspended(null); WorkflowControlClient controlClient = new WorkflowControlClient(controlEndpoint); controlClient.Unsuspend(instanceId); Console.WriteLine("Hit any key to exit Host..."); Console.ReadLine(); }
static void Main() { Console.WriteLine("Client starting..."); IWorkflowCreation creationClient = new ChannelFactory<IWorkflowCreation>(new BasicHttpBinding(), "http://localhost/DataflowControl.xaml/Creation").CreateChannel(); // Start a new instance of the workflow Guid instanceId = creationClient.CreateSuspended(null); WorkflowControlClient controlClient = new WorkflowControlClient( new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml"))); controlClient.Unsuspend(instanceId); Console.WriteLine("Client exiting..."); }
static void Snippet8() { // <Snippet8> IWorkflowCreation creationClient = new ChannelFactory <IWorkflowCreation>(new BasicHttpBinding(), "http://localhost/DataflowControl.xaml/Creation").CreateChannel(); Guid instanceId = creationClient.CreateSuspended(null); WorkflowControlClient controlClient = new WorkflowControlClient( new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml"))); controlClient.Unsuspend(instanceId); // ... controlClient.Cancel(instanceId); // </Snippet8> }
static void Main() { Console.WriteLine("Client starting..."); IWorkflowCreation creationClient = new ChannelFactory <IWorkflowCreation>(new BasicHttpBinding(), "http://localhost/DataflowControl.xaml/Creation").CreateChannel(); // Start a new instance of the workflow Guid instanceId = creationClient.CreateSuspended(null); WorkflowControlClient controlClient = new WorkflowControlClient( new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml"))); controlClient.Unsuspend(instanceId); Console.WriteLine("Client exiting..."); }
static void Main() { // Same workflow as Dataflow sample Activity workflow = LoadProgram("Dataflow.xaml"); WorkflowServiceHost host = new WorkflowServiceHost(workflow, new Uri("http://localhost/Dataflow.xaml")); host.Description.Behaviors.Add(new SqlWorkflowInstanceStoreBehavior { ConnectionString = ConfigurationManager.ConnectionStrings["persistenceStore"].ConnectionString, InstanceEncodingOption = InstanceEncodingOption.None, InstanceCompletionAction = InstanceCompletionAction.DeleteAll, InstanceLockedExceptionAction = InstanceLockedExceptionAction.NoRetry, HostLockRenewalPeriod = new TimeSpan(0, 0, 30), RunnableInstancesDetectionPeriod = new TimeSpan(0, 0, 5) }); WorkflowControlEndpoint controlEndpoint = new WorkflowControlEndpoint( new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml"))); CreationEndpoint creationEndpoint = new CreationEndpoint( new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml/Creation"))); host.AddServiceEndpoint(controlEndpoint); host.AddServiceEndpoint(creationEndpoint); host.Open(); Console.WriteLine("Host open..."); IWorkflowCreation creationClient = new ChannelFactory <IWorkflowCreation>(creationEndpoint.Binding, creationEndpoint.Address).CreateChannel(); // Start a new instance of the workflow Guid instanceId = creationClient.CreateSuspended(null); WorkflowControlClient controlClient = new WorkflowControlClient(controlEndpoint); controlClient.Unsuspend(instanceId); Console.WriteLine("Hit any key to exit Host..."); Console.ReadLine(); }
static void Main() { Console.WriteLine("Client starting..."); try { IWorkflowCreation creationClient = new ChannelFactory <IWorkflowCreation>(new BasicHttpBinding(), "http://localhost/DataflowControl.xaml/Creation").CreateChannel(); // Start a new instance of the workflow Guid instanceId = creationClient.CreateSuspended(null); // initialize workflow control client WorkflowControlClient controlClient = new WorkflowControlClient( new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml"))); controlClient.Unsuspend(instanceId); Console.WriteLine($"Client exiting..."); // you should have an instance persisted by now Thread.Sleep(10000); // if cancel, goes in executing, suspended -> idle, not-suspended // if abandon, goes in executing, suspended and stays there // if terminate, clears the instance from database controlClient.Terminate(instanceId); Console.WriteLine($"instance terminated..."); // you should have the persistence workflow instance removed from database by now } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadLine(); }