-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from conductor-sdk/docs-updates
- Loading branch information
Showing
10 changed files
with
87 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Conductor.Client.Extensions; | ||
using Conductor.Client.Interfaces; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Conductor.Client.Worker | ||
{ | ||
public static class WorkflowTaskHost | ||
{ | ||
public static IHost CreateWorkerHost<T>(Configuration configuration, params T[] workers) where T : IWorkflowTask | ||
{ | ||
return new HostBuilder() | ||
.ConfigureServices( | ||
(ctx, services) => | ||
{ | ||
services.AddConductorWorker(configuration); | ||
foreach (var worker in workers) | ||
{ | ||
services.AddConductorWorkflowTask(worker); | ||
} | ||
services.WithHostedService(); | ||
} | ||
).ConfigureLogging( | ||
logging => | ||
{ | ||
logging.SetMinimumLevel(LogLevel.Debug); | ||
logging.AddConsole(); | ||
} | ||
).Build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
using Conductor.Client.Extensions; | ||
using Microsoft.Extensions.Logging; | ||
using Conductor.Client.Worker; | ||
using Microsoft.Extensions.Hosting; | ||
using Tests.Worker; | ||
|
||
namespace Tests.Util | ||
{ | ||
public class WorkerUtil | ||
{ | ||
private static IHost _host = null; | ||
|
||
static WorkerUtil() | ||
{ | ||
_host = WorkflowTaskHost.CreateWorkerHost( | ||
ApiUtil.GetConfiguration(), | ||
new SimpleWorker() | ||
); | ||
} | ||
|
||
public static IHost GetWorkerHost() | ||
{ | ||
return new HostBuilder() | ||
.ConfigureServices( | ||
(ctx, services) => | ||
{ | ||
services.AddConductorWorker(ApiUtil.GetConfiguration()); | ||
services.AddConductorWorkflowTask<SimpleWorker>(); | ||
services.WithHostedService<WorkerService>(); | ||
} | ||
).ConfigureLogging( | ||
logging => | ||
{ | ||
logging.SetMinimumLevel(LogLevel.Debug); | ||
logging.AddConsole(); | ||
} | ||
).Build(); | ||
return _host; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,10 @@ | |
## A simple two-step workflow | ||
|
||
```csharp | ||
using Conductor.Client; | ||
using Conductor.Definition; | ||
using Conductor.Executor; | ||
|
||
ConductorWorkflow GetConductorWorkflow() | ||
{ | ||
return new ConductorWorkflow() | ||
|
@@ -11,27 +15,19 @@ ConductorWorkflow GetConductorWorkflow() | |
.WithOwner("[email protected]") | ||
.WithTask(new SimpleTask("simple_task_2", "simple_task_1")) | ||
.WithTask(new SimpleTask("simple_task_1", "simple_task_2")); | ||
|
||
WorkflowExecutor GetWorkflowExecutor() | ||
{ | ||
return new WorkflowExecutor( | ||
metadataClient: GetClient<MetadataResourceApi>(), | ||
workflowClient: GetClient<WorkflowResourceApi>() | ||
); | ||
} | ||
|
||
ConductorWorkflow conductorWorkflow = GetConductorWorkflow(); | ||
WorkflowExecutor workflowExecutor = GetWorkflowExecutor(); | ||
var configuration = new Configuration(); | ||
|
||
var conductorWorkflow = GetConductorWorkflow(); | ||
var workflowExecutor = new WorkflowExecutor(configuration); | ||
workflowExecutor.RegisterWorkflow( | ||
workflow: conductorWorkflow | ||
overwrite: true | ||
); | ||
String workflowId = workflowExecutor.StartWorkflow(conductorWorkflow); | ||
var workflowId = workflowExecutor.StartWorkflow(conductorWorkflow); | ||
``` | ||
|
||
### Workflow Management APIs | ||
See [Docs](/docs/readme/executor.md) for APIs to start, pause, resume, terminate, search and get workflow execution status. | ||
|
||
### More Examples | ||
You can find more examples at the following GitHub repository: | ||
|
||
|