Introduction
WorkManager is an event-driven worker management system built on Dapr that enables you to deploy, manage, and scale workers written in different programming languages. It provides a unified interface for creating workers, managing their lifecycle, and processing CloudEvents from pub/sub topics.
What is WorkManager?
WorkManager solves the problem of managing event-driven workers across different programming languages in a distributed system. Instead of writing custom worker infrastructure for each language, WorkManager provides:
- A unified worker abstraction: Workers subscribe to pub/sub topics and process CloudEvents
- Pluggable execution engines: Each language has its own engine that handles code execution
- Automatic recovery: Worker configurations are persisted to Dapr state store
- Distributed coordination: Built-in support for group-based mutually exclusive execution
When to Use WorkManager
WorkManager is ideal for:
- Event-driven processing pipelines: When you need to process messages from multiple topics in different languages
- Polyglot microservices: When different parts of your system are written in different languages but need to communicate via events
- Hot-deployable workers: When you need to update worker logic without restarting the processing pipeline
- Coordinated multi-worker execution: When multiple workers need to process the same topic without duplicate processing
Core Concepts
Workers
A worker is the fundamental unit of work in WorkManager. Each worker:
- Subscribes to a specific pub/sub topic
- Processes incoming CloudEvents using language-specific code
- Can publish output CloudEvents to other topics
- Has a unique identifier (GUID)
- Can be started, stopped, and have its code updated at runtime
Engines
Engines provide the runtime execution environment for worker code:
| Engine | Use Case |
|---|---|
| PythonEngine | When workers are written in Python and executed via python3 subprocess |
| CSharpSourceEngine | When workers are C# source code compiled at runtime via Roslyn |
| CSharpDllEngine | When workers are pre-compiled .NET assemblies |
Topics and Groups
- Topic: The pub/sub topic the worker subscribes to for incoming events
- Group: Optional coordination group that enables mutually exclusive execution across multiple workers
Code Sources
Workers can source their code from:
- Inline content: Base64-encoded code sent directly in the API request
- Remote URL: Code fetched from an HTTP(S) URL at worker creation time
System Requirements
- .NET 10.0 SDK
- Dapr runtime (1.x)
- Python 3.x (for Python workers)
- Docker (optional, for containerized deployment)
Next Steps
- Getting Started - Set up WorkManager and create your first worker
- Architecture - Understand the system design
- API Reference - Explore the full API surface