# Event Bus

> A mechanism that dispatches each emitted event to the handlers registered for its type.

Record: `architecture:event-bus`
Kind: mechanism
Layer: [Execution Core](https://banes-lab.com/records/layer/execution-core.md)
Severity: contextual
Scope: application, integration
Canonical: https://banes-lab.com/ontology#architecture-event-bus

Listed in [Architecture principles](https://banes-lab.com/api/records/architecture.md), after [Message Broker](https://banes-lab.com/records/architecture/message-broker.md) and before [Event Stream](https://banes-lab.com/records/architecture/event-stream.md).

## Repair

- Refactored by: Introduce Event Bus, Register Handlers
- Detected by: undocumented subscribers
- Violated by: hidden implicit event dependencies
- Measured by: event dependency visibility
- Enforced by: handler registry validation

## Requires

- [Event Contract](https://banes-lab.com/records/lexicon/event-contract.md)
- [Subscriber Model](https://banes-lab.com/records/lexicon/subscriber-model.md)

## Reinforces

- [Pub/Sub](https://banes-lab.com/records/lexicon/pub-sub.md)
- [Event-Driven Architecture](https://banes-lab.com/records/architecture/event-driven-architecture.md)

## Enables

- [Decoupled Event Distribution](https://banes-lab.com/records/lexicon/decoupled-event-distribution.md)

## Conflicts with

- [Direct Event Handler Calls](https://banes-lab.com/records/lexicon/direct-event-handler-calls.md)

## In tension with

- [Event Storm / Traceability](https://banes-lab.com/records/lexicon/event-storm-traceability.md)

## Tensions

- [Event Bus / Event Storm / Traceability](https://banes-lab.com/records/tension/event-bus-event-storm-traceability.md)

## Severity

- [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)

## Category

- [Event / Messaging / Asynchronous Architecture](https://banes-lab.com/records/architecture-category/event-messaging-asynchronous-architecture.md)

## Linked from

- [Execution joins the halves](https://banes-lab.com/software-architecture/principles/execution-joins-the-halves.md)
- [Event / Messaging / Asynchronous Architecture](https://banes-lab.com/ontology/principles/architecture-category-event-messaging-asynchronous-architecture.md)
- [Core Vocabulary](https://banes-lab.com/ontology/lexicon/lexicon-category-core-vocabulary.md)
- [Event Messaging Async](https://banes-lab.com/ontology/lexicon/lexicon-category-event-messaging-async.md)
- [Severity levels](https://banes-lab.com/ontology/schema/the-vocabulary-severity.md)
- [The resolutions](https://banes-lab.com/ontology/schema/the-resolutions.md)

## Evidence in the code

- [emitEvent](https://banes-lab.com/source/tree/core/buses/base.bus.ts.md)
- [subscribeEvent](https://banes-lab.com/source/tree/core/buses/base.bus.ts.md)
- [core/buses](https://banes-lab.com/anatomy/tree/folder-core-buses.md)
