SUB Command
Syntax
Parameters
Parameter | Description | Required | Example |
---|---|---|---|
CLIENT_ID | ID of the client subscribing to events | Yes |
|
EVENT_NAME | Type of event to subscribe to | Yes |
|
Response
Success
The response confirms that the subscription was successful and includes the event name that was subscribed to.
Error
Examples
Basic Subscription
Domain-Level Subscription
Subscribe to all events in a domain:
Notes
Event names follow a hierarchical path-like structure (e.g.,
domain/resource/action
)Wildcards can be used to subscribe to multiple event types (e.g.,
order/*
subscribes to all order events)Clients can subscribe to multiple event types by sending multiple SUB commands
When a client subscribes to an event type, it will immediately begin receiving any new events of that type
The system will check if the client has the necessary permissions to subscribe to the requested event type
Multiple instances of the same service can subscribe to the same event types, implementing the competing consumer pattern
Each instance will receive a unique client ID to track its subscriptions and event processing state