This project demonstrates a basic worker implementation using the Orkes Conductor C# SDK. It shows how to create a simple task worker that can process tasks from a Conductor workflow.
- .NET 9.0 or later
- An Orkes Conductor account
- Access key and secret from Orkes Conductor
-
Clone this repository:
git clone <repository-url> cd csharp-basic-worker
-
Install dependencies:
dotnet restore
-
Update the
Program.cs
file with your Conductor server details:var configuration = new Configuration() { BasePath = "YOUR_CONDUCTOR_SERVER_URL/api", AuthenticationSettings = new OrkesAuthenticationSettings( "YOUR_KEY", "YOUR_SECRET" ) };
Replace:
YOUR_CONDUCTOR_SERVER_URL
with your Conductor server URLYOUR_KEY
with your Orkes Conductor keyYOUR_SECRET
with your Orkes Conductor secret
-
Build the project:
dotnet build
-
Run the worker:
dotnet run
The worker will start polling for tasks of type "test-java-sdk". You should see output similar to:
Starting worker host...
Worker initialized with task type: test-java-sdk
Application started. Press Ctrl+C to shut down.
The example includes a simple worker that:
- Polls for tasks of type "test-java-sdk"
- Processes input data
- Returns a "Hello world" message combined with input parameters
- Marks tasks as completed
To use this worker, create a workflow in Conductor with a task that has:
- Task type: "test-java-sdk"
- Input parameters as needed
Example workflow definition:
{
"name": "test_workflow",
"version": 1,
"tasks": [
{
"name": "test_task",
"taskReferenceName": "test_task_ref",
"type": "test-java-sdk",
"inputParameters": {
"key": "value"
}
}
]
}
If the worker isn't processing tasks:
- Verify your Conductor server URL and credentials
- Check that the task type matches exactly in both worker and workflow
- Ensure the workflow is properly registered in Conductor
- Check the Conductor UI for task status and any error messages
- conductor-csharp (v3.14.0)
- .NET 9.0