events-default
events-defaultDefault in-process events plugin for BSB event routing
events-default
events-default is the built-in in-process events plugin for BSB.
It handles plugin-to-plugin communication inside a single runtime.
What It Supports
- Fire-and-forget events
- Returnable events (request/response)
- Broadcast events
- Stream relay support
Minimal Example
default:
events:
events-default:
plugin: events-default
enabled: true
Operational Characteristics
- In-memory only
- No cross-container message routing
- No broker-backed durability/replay
When To Replace
Replace with a distributed events backend when you run multiple BSB instances or need durable messaging.
Events-Default Patterns
events-default supports all core BSB event patterns in-process.
Fire-And-Forget
Use for async notifications where no response is needed.
await this.events.emitEvent(obs, "service-orders", "order.created", [{ id: "o1" }]);
Returnable Events
Use for request/response between plugins.
const user = await this.events.emitEventAndReturn(
obs,
"service-users",
"user.get",
10,
[{ id: "u1" }]
);
Broadcast
Use for fan-out events to all listeners.
await this.events.emitBroadcast(obs, "service-cache", "cache.flush", []);
Streams
Use for large payloads / continuous transfer.
const streamId = await this.events.receiveStream(obs, "service-files", "file.stream", async () => {});
Operational Notes
- In-memory only (single process/container boundary).
- No broker durability.
- Replace with distributed event plugins for multi-instance deployments.
Installation
Install plugin (Node.js)
npm i @bsb/base
Configuration
Configuration options for this plugin:
No configuration required
Available Versions
v9.0.3