Infrastructure Messages Reference
Reference page for the infrastructure messages of @artstesh/postboy (applies to v3.5.x).
Since v3.5 these executors are the only way to mutate the bus. All are dispatched via postboy.exec(...), all declare their own static ID, and all flow through the Execute stage of the middleware pipeline — filter them out with canHandle if your middleware gates domain commands only (see Middleware).
Registration
ConnectMessage<T>
Registers a message subject (replaces the deprecated record/recordWithPipe). The optional pipe shapes the observable that sub hands out — e.g. s => s.pipe(auditTime(200)).
ConnectExecutor<E, T>
Registers the handler function invoked by exec for this executor type (replaces recordExecutor).
ConnectHandler<E, R>
Registers a handler object whose handle(executor) is invoked for the type (replaces recordHandler).
DisconnectMessage
Unregisters a message type by its static ID: completes the subject (subscriber streams end), runs the registered completion callbacks, and also drops any executor handler registered under the same ID. Further fire/sub of the type throws.
Pipeline
AddMiddleware / RemoveMiddleware
Append to / remove from the middleware pipeline. Removal is by instance identity and calls the middleware's dispose(). The same instance added twice runs its hooks twice. See Middleware.
Locking
LockMessage<T> / UnlockMessage<T>
Adds the type's static ID to the lock set / removes it. A locked type's delivery via fire and fireCallback is silently skipped — no error, no notification to subscribers; registration and sub keep working, middleware hooks still run. Mute, not error. Never lock IDs you don't own: to their subscribers a locked type looks exactly like data loss.
Namespaces
AddNamespace
Creates the namespace and returns its PostboyAbstractRegistrator — record messages and executors on it, then tear them all down at once. Executing it again with the same name returns the same registrator without recreating it.
EliminateNamespace
Tears the namespace down (down() on its registrator — a DisconnectMessage for every recorded ID) and removes it. Unknown names are ignored. The whole bus tear-down (postboy.dispose()) eliminates every namespace as well. See Namespaces.
Removal from ≤3.4
Removed service method | Message replacement |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
See Migrating middleware from 3.4 for the reasoning behind the removals and Versions for the version lines.