NATSEventBridge publishes events to a NATS subject and subscribes to the same subject for inbound forwarding.
Optional dependencies
- Python
- TypeScript
Install the NATS extra (recommended):Equivalent direct dependency install:
Constructor params
server: NATS server URL (for examplenats://localhost:4222)subject: subject name used for publish/subscribename: optional bridge label
- Python
- TypeScript
Setup with a bus
- Python
- TypeScript
Behavior
emit(...)publishes serialized event JSON bytes to the configured subject.on(...)registers inbound handlers and auto-starts subscription.- Inbound messages are decoded, reset, and re-emitted on the internal bus.
close()drains/closes NATS connections and stops the internal bus.- Runtime requirements: Python needs
nats-py, TypeScript needsnatsand Node.js.