The default mode for managing subscriptions is auto subscribe. Every time a subscriber endpoint is started, it determines which events it needs to subscribe to and automatically subscribes to them. For more information on how publish and subscribe works, refer to Publish-Suscribe.
Messages matching the following criteria will be auto subscribed at startup.
- Defined as an event either using
IEventor by the
- At least one message handler and/or saga exists for the given event.
- If the selected transport does not support publish-subscribe natively, the publisher for that message needs to be specified via the routing API.
Events that are only handled by sagas are not subscribed to by default.
In Version 3 all messages not defined as a command using
ICommand or the
. convention are automatically subscribed.
A Subscriber will not unsubscribe when it stops, it will remain registered at the publisher to receive events. The publisher still sends events to the queue of the stopped subscriber. When the subscriber is started it will consume the messages from its queue. The subscriber will never lose an event.
Events can manually be subscribed and unsubscribed: