This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

update domain event handling guide with in memory steps

+20 -1
+20 -1
.agent/logs/202601229_domain_event_handling_guide.md
··· 324 324 6. `src/modules/<module>/application/useCases/...UseCase.ts` — Extend BaseUseCase, publish events 325 325 7. `src/shared/infrastructure/http/factories/UseCaseFactory.ts` — Pass eventPublisher 326 326 8. `src/modules/<module>/application/eventHandlers/...Handler.ts` — Create handler 327 - 9. `src/shared/infrastructure/processes/<Worker>Process.ts` — Register handler 327 + 9. `src/shared/infrastructure/processes/<Worker>Process.ts` — Register handler (production) 328 + 10. `src/shared/infrastructure/processes/InMemoryEventWorkerProcess.ts` — Register handler (mock mode) 328 329 329 330 ## Build steps: 330 331 ··· 340 341 'workers/notification-worker': 'src/workers/notification-worker.ts', 341 342 }, 342 343 ``` 344 + 345 + ## Mock Mode (In-Memory Events) 346 + 347 + When running in mock/development mode with `USE_MOCK_PERSISTENCE=true`, the system uses `InMemoryEventPublisher` and `InMemoryEventSubscriber` instead of BullMQ/Redis. 348 + 349 + **IMPORTANT:** Event handlers must be registered in BOTH places: 350 + 351 + 1. **Production:** `src/shared/infrastructure/processes/NotificationWorkerProcess.ts` (or FeedWorkerProcess, SearchWorkerProcess) 352 + 2. **Mock Mode:** `src/shared/infrastructure/processes/InMemoryEventWorkerProcess.ts` 353 + 354 + If you add a new event handler to a worker process, you MUST also add it to `InMemoryEventWorkerProcess.ts` or it will only work in production and fail silently in development/test mode. 355 + 356 + **Example:** When adding follow notification handlers: 357 + 358 + - Added to `NotificationWorkerProcess.ts` (production) 359 + - **MUST ALSO** add to `InMemoryEventWorkerProcess.ts` (mock mode) 360 + 361 + The in-memory worker consolidates ALL event handlers (feeds, search, notifications) into a single process since there's no queue distribution in mock mode.