pub struct SubscriptionEngine { /* private fields */ }Expand description
The subscription engine orchestrates the entire subscription pipeline.
It is designed to be invoked asynchronously after resource writes
(fire-and-forget via tokio::spawn), mirroring the audit middleware pattern.
Implementations§
Source§impl SubscriptionEngine
impl SubscriptionEngine
Sourcepub fn new(config: SubscriptionConfig, base_url: String) -> Self
pub fn new(config: SubscriptionConfig, base_url: String) -> Self
Creates a new subscription engine with a no-op outbound auth provider.
Sourcepub fn with_outbound_auth(
config: SubscriptionConfig,
base_url: String,
outbound_auth: Arc<dyn OutboundAuthProvider>,
) -> Self
pub fn with_outbound_auth( config: SubscriptionConfig, base_url: String, outbound_auth: Arc<dyn OutboundAuthProvider>, ) -> Self
Creates a new subscription engine with a custom outbound auth provider.
The provider is used by channels that initiate outbound HTTP requests
(currently the FHIR Messaging channel) to attach server-side
credentials when the subscription does not supply its own
Authorization header.
Sourcepub fn topic_registry(&self) -> &Arc<InMemoryTopicRegistry>
pub fn topic_registry(&self) -> &Arc<InMemoryTopicRegistry>
Returns a reference to the topic registry.
Sourcepub fn manager(&self) -> &Arc<SubscriptionManager>
pub fn manager(&self) -> &Arc<SubscriptionManager>
Returns a reference to the subscription manager.
Sourcepub fn ws_manager(&self) -> &Arc<WebSocketManager>
pub fn ws_manager(&self) -> &Arc<WebSocketManager>
Returns a reference to the WebSocket manager.
Sourcepub fn ws_token_manager(&self) -> &Arc<WsBindingTokenManager>
pub fn ws_token_manager(&self) -> &Arc<WsBindingTokenManager>
Returns a reference to the WebSocket binding token manager.
Sourcepub async fn on_resource_event(&self, event: ResourceEvent)
pub async fn on_resource_event(&self, event: ResourceEvent)
Called after a resource write has been committed.
This method:
- Handles subscription/topic lifecycle events (if the written resource is a Subscription, SubscriptionTopic, or an R4 backport Basic topic).
- Evaluates the event against all active subscriptions.
- Builds and dispatches notifications.
Auto Trait Implementations§
impl !RefUnwindSafe for SubscriptionEngine
impl !UnwindSafe for SubscriptionEngine
impl Freeze for SubscriptionEngine
impl Send for SubscriptionEngine
impl Sync for SubscriptionEngine
impl Unpin for SubscriptionEngine
impl UnsafeUnpin for SubscriptionEngine
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