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 Snippet2() { // <Snippet2> WorkflowControlEndpoint wce = new WorkflowControlEndpoint(new BasicHttpBinding(), new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml"))); WorkflowControlClient controlClient = new WorkflowControlClient(wce); // </Snippet2> }
protected void OnCancelClick(object sender, EventArgs e) { WorkflowControlClient controlClient = new WorkflowControlClient(new BasicHttpBinding(), new EndpointAddress(new Uri("http://127.0.0.1/hiringProcess"))); controlClient.Cancel(info.WorkflowInstanceId); // hide all button this.HideAllButtons("Cancellation sent, click here to go back to the Inbox"); }
protected void OnCancelClick(object sender, EventArgs e) { // perform cancellation WorkflowControlClient controlClient = new WorkflowControlClient(new BasicHttpBinding(), new EndpointAddress(new Uri("http://127.0.0.1/hiringProcess"))); controlClient.Cancel(info.WorkflowInstanceId); // set UI this.btnCancel.Visible = false; this.btnBack.Width = new System.Web.UI.WebControls.Unit(400, System.Web.UI.WebControls.UnitType.Pixel); this.btnBack.Text = "Cancellation sent, click here to go back to the Inbox"; }
static void Snippet11() { // <Snippet11> 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.Suspend(instanceId, "Sample to suspend"); // </Snippet11> }
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() { 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 Cancel() { try { Console.WriteLine("Enter an OrderId to cancel"); String input = Console.ReadLine(); Int32 orderIdToCancel = 0; if (String.IsNullOrEmpty(input)) { Console.WriteLine("A value must be entered"); return; } Int32.TryParse(input, out orderIdToCancel); if (orderIdToCancel == 0) { Console.WriteLine("OrderId must not be zero"); return; } Guid instanceId = Guid.Empty; if (!queriedInstances.TryGetValue(orderIdToCancel, out instanceId)) { Console.WriteLine("Instance not found"); return; } using (WorkflowControlClient client = new WorkflowControlClient("ClientControlEndpoint")) { client.Cancel(instanceId); } } catch (Exception exception) { lastOrderId = 0; Console.WriteLine("Cancel Unhandled exception: {0}", exception.Message); } }
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(); }
static void Snippet4() { // <Snippet4> WorkflowControlClient controlClient = new WorkflowControlClient("ConfigName", new EndpointAddress(new Uri("http://localhost/DataflowControl.xaml"))); // </Snippet4> }
static void Snippet5() { // <Snippet5> WorkflowControlClient controlClient = new WorkflowControlClient("ConfigName", "http://localhost/DataflowControl.xaml"); // </Snippet5> }
static void Snippet3() { // <Snippet3> WorkflowControlClient controlClient = new WorkflowControlClient("ConfigName"); // </Snippet3> }
public FlowTasksControl(string clientControlEndPoint) { _controlClient = new WorkflowControlClient(new BasicHttpBinding(), new EndpointAddress(clientControlEndPoint)); }