Quick Start
Ten minutes from zero to a working bus: define a message, register it, subscribe, fire it — then a synchronous command and an async query, with proper teardown.
1. Define a message
Every message class declares its own unique static readonly ID. The ID is the routing key — never inherit a parent's ID and never reuse an ID across classes.
2. Register, subscribe, fire
Register before use: fire throws for unregistered IDs.
For anything beyond a demo, group registrations in a registrator — its down() disconnects everything at once.
3. A synchronous command
exec runs a registered handler and returns the result directly — it is synchronous, never await it.
4. An async query
For asynchronous results use PostboyCallbackMessage and fireCallback. The responder completes the message with finish(...).
Note: without the second action argument, fireCallback dispatches lazily — the request is sent only when the returned Observable is subscribed. See Callbacks.
5. Tear down
Subjects are not auto-completed. Use a registrator's down() (or exec(new DisconnectMessage(OrderPlacedEvent.ID))) when a feature shuts down, and postboy.dispose() when the whole bus goes away.
Next steps
Concepts and How it works — the model behind these steps.
Testing Quick Start — test this code with
PostboyWorld.