eventing-hub
8
总安装量
8
周安装量
#35352
全站排名
安装命令
npx skills add https://github.com/7spade/black-tortoise --skill eventing-hub
Agent 安装分布
codex
8
opencode
7
gemini-cli
7
replit
7
claude-code
7
mcpjam
6
Skill 文档
Eventing Hub Master Guide
Intent
Describe event contracts, persistence/publish order, and consumer safety for the shared EventBus described in src/app/eventing/AGENTS.md and .github/instructions/20-ddd-event-sourcing-copilot-instructions.md.
Event Schema
- Declare events with a Type, Payload, Metadata, and Semantics structure; keep payloads immutable and document any allowed mutations in the metadata.
- Use a
correlationIdto tie related events, and assign acausationIdthat points to the triggering event (null only for root events). - Emit only typed events from the Aggregates/Application services; do not publish raw DTOs or Firebase objects.
Append â Publish â React
- Persist every outcome (Append) before invoking the
EventBuspublish step; never wrap append/publish inPromise.allor parallel flows to avoid causality gaps. - After the append promise resolves, publish the event and let downstream stores/projections react via the global
EventBussingleton. - Reactions should be limited to simple projections or side effects; long-running work belongs to dedicated use cases handled by the Application layer.
Causality Tracking & Immutability
- Maintain causation/correlation IDs for every published event; log them for tracing and include them in metadata for audit tooling.
- Treat emitted events as read-only facts; consumers may inspect but must never mutate payload or metadata objects.
- Use
Object.freeze()or deep copies when broadcasting to ensure immutability guarantees reach all subscribers.
Safe Subscriptions
- Convert the RxJS stream behind
EventBusinto signals at the Application boundary usingtoSignal()before exposing data to Presentation stores. - Guard subscriptions with
takeUntilDestroyed()or signal-based cleanup so that event handlers do not leak after a component/store is destroyed. - Prefer
@ngrx/signalsstores for reacting to events; theirwithMethodshandlers should callpatchStatebased on event payloads rather than mutating the store directly.
Validation & Monitoring
- Validate payload schemas before append, using domain value objects to enforce invariants (Domain layer) and rejecting invalid data early.
- Emit audit events when Append or Publish steps fail so
docs/AUDIT-*trackers capture the problem context. - Feed causality IDs into any observability tooling to verify the AppendâPublishâReact chain during CI or runtime tracing.