pub struct SubscriptionManager { /* private fields */ }Expand description
Manages the lifecycle and in-memory indexing of active subscriptions.
Implementations§
Source§impl SubscriptionManager
impl SubscriptionManager
Sourcepub fn new(
topic_registry: Arc<InMemoryTopicRegistry>,
supported_channels: Vec<String>,
) -> Self
pub fn new( topic_registry: Arc<InMemoryTopicRegistry>, supported_channels: Vec<String>, ) -> Self
Creates a new subscription manager.
Sourcepub fn register(
&self,
tenant_id: &str,
subscription_id: &str,
resource: &Value,
fhir_version: FhirVersion,
) -> Result<ActiveSubscription, SubscriptionError>
pub fn register( &self, tenant_id: &str, subscription_id: &str, resource: &Value, fhir_version: FhirVersion, ) -> Result<ActiveSubscription, SubscriptionError>
Registers a subscription from a FHIR Subscription resource JSON.
Validates the topic URL, channel type, and filter criteria. On success, the subscription is stored in the in-memory index.
Sourcepub fn deregister(&self, tenant_id: &str, subscription_id: &str) -> bool
pub fn deregister(&self, tenant_id: &str, subscription_id: &str) -> bool
Removes a subscription from the in-memory index.
Sourcepub fn active_subscriptions_for_topic(
&self,
tenant_id: &str,
topic_url: &str,
) -> Vec<ActiveSubscription>
pub fn active_subscriptions_for_topic( &self, tenant_id: &str, topic_url: &str, ) -> Vec<ActiveSubscription>
Returns all active subscriptions for a given topic URL within a tenant.
Sourcepub fn get_subscription(
&self,
tenant_id: &str,
subscription_id: &str,
) -> Option<ActiveSubscription>
pub fn get_subscription( &self, tenant_id: &str, subscription_id: &str, ) -> Option<ActiveSubscription>
Gets the current status of a subscription.
Sourcepub fn update_status(
&self,
tenant_id: &str,
subscription_id: &str,
new_status: SubscriptionStatusCode,
) -> Result<SubscriptionStatusCode, SubscriptionError>
pub fn update_status( &self, tenant_id: &str, subscription_id: &str, new_status: SubscriptionStatusCode, ) -> Result<SubscriptionStatusCode, SubscriptionError>
Updates the status of a subscription.
Sourcepub fn increment_event_count(
&self,
tenant_id: &str,
subscription_id: &str,
) -> Option<u64>
pub fn increment_event_count( &self, tenant_id: &str, subscription_id: &str, ) -> Option<u64>
Increments the event counter and returns the new value.
Sourcepub fn record_failure(
&self,
tenant_id: &str,
subscription_id: &str,
) -> Option<u32>
pub fn record_failure( &self, tenant_id: &str, subscription_id: &str, ) -> Option<u32>
Records a delivery failure and returns the new consecutive failure count.
Sourcepub fn reset_failures(&self, tenant_id: &str, subscription_id: &str)
pub fn reset_failures(&self, tenant_id: &str, subscription_id: &str)
Resets the consecutive failure counter after a successful delivery.
Sourcepub fn all_subscriptions(&self) -> Vec<ActiveSubscription>
pub fn all_subscriptions(&self) -> Vec<ActiveSubscription>
Returns all subscriptions (for heartbeat checking, initialization, etc.).
Auto Trait Implementations§
impl !RefUnwindSafe for SubscriptionManager
impl Freeze for SubscriptionManager
impl Send for SubscriptionManager
impl Sync for SubscriptionManager
impl Unpin for SubscriptionManager
impl UnsafeUnpin for SubscriptionManager
impl UnwindSafe for SubscriptionManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more