pub struct EventSystem { /* private fields */ }events only.Expand description
Central event system that coordinates all event delivery mechanisms
Implementations§
Source§impl EventSystem
impl EventSystem
Sourcepub fn with_config(config: EventConfig) -> Self
pub fn with_config(config: EventConfig) -> Self
Create a new event system with custom configuration
Source§impl EventSystem
impl EventSystem
Sourcepub const fn emitter(&self) -> &EventEmitter
pub const fn emitter(&self) -> &EventEmitter
Get the event emitter for publishing events
Sourcepub fn subscribe(&self) -> EventSubscription
pub fn subscribe(&self) -> EventSubscription
Subscribe to all events
Sourcepub fn subscribe_filtered<F>(&self, filter: F) -> FilteredSubscription<F>
pub fn subscribe_filtered<F>(&self, filter: F) -> FilteredSubscription<F>
Subscribe to events matching a filter
Sourcepub fn register_webhook(&self, webhook: Webhook) -> Uuid
pub fn register_webhook(&self, webhook: Webhook) -> Uuid
Register a webhook endpoint.
This is a legacy API that preserves the previous Uuid-returning
contract. Prefer register_webhook_strict or
try_register_webhook when you need explicit
failure handling.
Sourcepub fn register_webhook_strict(
&self,
webhook: Webhook,
) -> Result<Uuid, WebhookRegistrationError>
pub fn register_webhook_strict( &self, webhook: Webhook, ) -> Result<Uuid, WebhookRegistrationError>
Register a webhook endpoint with explicit failure semantics.
Sourcepub fn try_register_webhook(&self, webhook: Webhook) -> Option<Uuid>
pub fn try_register_webhook(&self, webhook: Webhook) -> Option<Uuid>
Register a webhook endpoint.
Returns None when registration is rejected (e.g. unsafe URL),
or when webhooks are disabled.
Sourcepub fn unregister_webhook(&self, id: Uuid) -> bool
pub fn unregister_webhook(&self, id: Uuid) -> bool
Unregister a webhook
Sourcepub fn list_webhooks(&self) -> Vec<Webhook>
pub fn list_webhooks(&self) -> Vec<Webhook>
List all registered webhooks
Sourcepub fn webhook_deliveries(&self, webhook_id: Uuid) -> Vec<WebhookDelivery>
pub fn webhook_deliveries(&self, webhook_id: Uuid) -> Vec<WebhookDelivery>
Get delivery history for a webhook (newest-first).
Sourcepub const fn config(&self) -> &EventConfig
pub const fn config(&self) -> &EventConfig
Get configuration
Sourcepub fn event_store(&self) -> Option<&(dyn EventStore + Send + Sync)>
pub fn event_store(&self) -> Option<&(dyn EventStore + Send + Sync)>
Access the configured event store, if enabled.
Sourcepub fn emit(&self, event: CommerceEvent)
pub fn emit(&self, event: CommerceEvent)
Emit an event.
Broadcast delivery is non-blocking. Webhook delivery is dispatched to a background task. Event persistence (if enabled) is best-effort and may block depending on the configured store.
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Get the number of active subscribers
Sourcepub fn bus_publish_failures(&self) -> u64
pub fn bus_publish_failures(&self) -> u64
Get total publish failures on the event bus