···3243246. `src/modules/<module>/application/useCases/...UseCase.ts` — Extend BaseUseCase, publish events
3253257. `src/shared/infrastructure/http/factories/UseCaseFactory.ts` — Pass eventPublisher
3263268. `src/modules/<module>/application/eventHandlers/...Handler.ts` — Create handler
327327-9. `src/shared/infrastructure/processes/<Worker>Process.ts` — Register handler
327327+9. `src/shared/infrastructure/processes/<Worker>Process.ts` — Register handler (production)
328328+10. `src/shared/infrastructure/processes/InMemoryEventWorkerProcess.ts` — Register handler (mock mode)
328329329330## Build steps:
330331···340341 'workers/notification-worker': 'src/workers/notification-worker.ts',
341342 },
342343```
344344+345345+## Mock Mode (In-Memory Events)
346346+347347+When running in mock/development mode with `USE_MOCK_PERSISTENCE=true`, the system uses `InMemoryEventPublisher` and `InMemoryEventSubscriber` instead of BullMQ/Redis.
348348+349349+**IMPORTANT:** Event handlers must be registered in BOTH places:
350350+351351+1. **Production:** `src/shared/infrastructure/processes/NotificationWorkerProcess.ts` (or FeedWorkerProcess, SearchWorkerProcess)
352352+2. **Mock Mode:** `src/shared/infrastructure/processes/InMemoryEventWorkerProcess.ts`
353353+354354+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.
355355+356356+**Example:** When adding follow notification handlers:
357357+358358+- Added to `NotificationWorkerProcess.ts` (production)
359359+- **MUST ALSO** add to `InMemoryEventWorkerProcess.ts` (mock mode)
360360+361361+The in-memory worker consolidates ALL event handlers (feeds, search, notifications) into a single process since there's no queue distribution in mock mode.