2.4 KiB
2.4 KiB
type, category, name, version, status, tags, dependencies, emits, subscribes
| type | category | name | version | status | tags | dependencies | emits | subscribes | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| step | event | Calendar Sync All | 1.0.0 | active |
|
|
|
|
Calendar Sync All Step
Zweck
Fetcht alle Mitarbeiter von Advoware und emittiert calendar_sync_employee Event pro Mitarbeiter. Ermöglicht parallele Verarbeitung.
Config
{
'type': 'event',
'name': 'Calendar Sync All',
'subscribes': ['calendar_sync_all'],
'emits': ['calendar_sync_employee'],
'flows': ['advoware_cal_sync']
}
Input Event
{
"topic": "calendar_sync_all",
"data": {}
}
Verhalten
-
Fetch Employees von Advoware API:
employees = await advoware.api_call('/employees') -
Filter Debug-Liste (wenn konfiguriert):
if Config.CALENDAR_SYNC_DEBUG_KUERZEL: employees = [e for e in employees if e['kuerzel'] in debug_list] -
Set Lock pro Employee:
lock_key = f'calendar_sync:lock:{kuerzel}' redis.set(lock_key, '1', nx=True, ex=300) -
Emit Event pro Employee:
await context.emit({ 'topic': 'calendar_sync_employee', 'data': { 'kuerzel': kuerzel, 'full_content': True } })
Debug-Modus
# Only sync specific employees
export CALENDAR_SYNC_DEBUG_KUERZEL=SB,AI,RO
# Sync all (production)
export CALENDAR_SYNC_DEBUG_KUERZEL=
Error Handling
- Advoware API Fehler: Loggen, aber nicht crashen
- Lock-Fehler: Employee skippen (bereits in Sync)
- Event Emission Fehler: Loggen und fortfahren
Output Events
Multiple calendar_sync_employee events, z.B.:
[
{"topic": "calendar_sync_employee", "data": {"kuerzel": "SB", "full_content": true}},
{"topic": "calendar_sync_employee", "data": {"kuerzel": "AI", "full_content": true}},
...
]
Performance
- ~10 employees: <1s für Fetch + Event Emission
- Lock-Setting: <10ms pro Employee
- Keine Blockierung (async events)
Monitoring
[INFO] Fetching employees from Advoware
[INFO] Found 10 employees
[INFO] Emitting calendar_sync_employee for SB
[INFO] Emitting calendar_sync_employee for AI
...
Related
- calendar_sync_event_step.md - Consumes emitted events
- calendar_sync_cron_step.md - Triggers this step