Skip to content

Commit d4b1d2b

Browse files
committed
Add partition resolution priority documentation
1 parent 01d88b3 commit d4b1d2b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,24 @@ Set a default resolver in config for all jobs:
390390
},
391391
```
392392

393+
### Partition Resolution Priority
394+
395+
When determining the partition key, the following order is used:
396+
397+
| Priority | Method | Description |
398+
|----------|--------|-------------|
399+
| 1 | `onPartition()` | Explicitly set when dispatching |
400+
| 2 | `getPartitionKey()` | Custom method defined in your job class |
401+
| 3 | `partition_resolver` | Global resolver from config |
402+
| 4 | Auto-detection | Properties: `userId`, `user_id`, `tenantId`, `tenant_id` |
403+
| 5 | `'default'` | Fallback partition |
404+
405+
The first non-null value wins. This allows you to:
406+
- Override everything with `onPartition()` at dispatch time
407+
- Define custom logic per job with `getPartitionKey()`
408+
- Set a global default with `partition_resolver` in config
409+
- Rely on automatic detection for simple cases
410+
393411
---
394412

395413
## Advanced Usage

0 commit comments

Comments
 (0)