background-jobs-and-events
Installation
SKILL.md
Background Jobs & Events (ABP)
Guidance for the ABP event bus (local + distributed), background jobs, and background workers. All APIs below are verified against ABP source. Inject services via constructor; the event bus only subscribes handlers that are already registered in DI, so a handler class must be registered (e.g. by implementing ITransientDependency or explicit registration) — implementing the handler interface alone is not enough.
When to Use
- Decouple code in the same process by publishing/handling local events.
- React to entity create/update/delete performed through a repository.
- Notify other microservices/apps of something that happened (distributed events).
- Queue one-shot work to run later, with automatic retry on failure (background jobs).
- Run recurring/periodic loops (cleanup, polling) as background workers.
When Not to Use
- Coordinating a critical section across app instances or typed distributed caching — use the distributed-caching-and-locking skill (
IAbpDistributedLock,IDistributedCache<T>). - Pushing real-time updates to connected clients — use the add-signalr-realtime skill.
- Defining the message/contract shape between microservices at the architecture level — use the design-module-and-service-communication skill.