OptionalonError: (err: unknown, topic: string) => voidInvoked when a subscriber throws. Delivery continues to the
remaining subscribers regardless. Defaults to console.error.
Publishes message to all current subscribers of topic.
The topic to publish on.
The payload to deliver to subscribers.
Subscribes handler to topic.
The topic to subscribe to.
Callback invoked with each message published to the topic.
An Unsubscribe function that removes this subscription when called.
In-process MessageBus that delivers messages synchronously to local subscribers.
Remarks
Suitable for single-process deployments and tests; messages are not propagated across processes or hosts. During publish the subscriber set is snapshotted, so handlers may subscribe or unsubscribe without disturbing the current delivery. Although the method is
async, delivery to handlers happens synchronously before the returned promise resolves.Example