pub struct AggregatorService { /* private fields */ }Implementations§
Source§impl AggregatorService
impl AggregatorService
Sourcepub fn new(
config: AggregatorConfig,
late_tx: Sender<Exchange>,
language_registry: SharedLanguageRegistry,
route_cancel: CancellationToken,
) -> Self
pub fn new( config: AggregatorConfig, late_tx: Sender<Exchange>, language_registry: SharedLanguageRegistry, route_cancel: CancellationToken, ) -> Self
Lifecycle invariant: sweep_cancel is initially seeded from the
route’s cancellation token and wrapped in a swappable Arc<Mutex<...>>
cell. StepLifecycle::start replaces it with a fresh token so the
sweep respawns after a restart. Construction is runtime-free (no
tokio::spawn here). The maintenance sweep task (TTL eviction when
bucket_ttl is set, queue-depth sampling when queue_metrics is
set) is spawned LAZILY on the first poll_ready and bound to the
current sweep_cancel token via select!.
The route owner MUST call shutdown to cancel it;
Drop also aborts it as defense-in-depth.
Sourcepub fn with_queue_metrics(
self,
metrics: Arc<dyn MetricsCollector>,
label: impl Into<String>,
) -> Self
pub fn with_queue_metrics( self, metrics: Arc<dyn MetricsCollector>, label: impl Into<String>, ) -> Self
Inject queue-depth reporting: the TTL-sweep maintenance pass publishes
the buffered group count (open correlation buckets) as
camel_queue_depth{queue = label}. label is the route-scoped
closed-set identifier (aggregator:<route>).
pub fn config(&self) -> &AggregatorConfig
pub fn has_timeout(&self) -> bool
pub fn force_complete_all(&self)
Sourcepub fn release_unarmed_buckets(&self)
pub fn release_unarmed_buckets(&self)
Consumer-exit release (bd rc-iioeq): discard buckets with NO armed timeout task, leave armed buckets untouched.
After a natural consumer exit no further exchanges arrive, so a
bucket without an armed timeout task can never complete on its
own — its buffered exchanges are released eagerly (the same
discard semantics force_complete_all applies with
force_completion_on_stop=false). A bucket WITH an armed timeout
task is left alone: that task owns its completion and emits
through the late channel when the timeout fires.
Arming is decided per bucket in call: when the
max_timeout_tasks cap is reached, a timeout-configured bucket
stays unarmed. Without this release such a bucket would be
orphaned forever — the bucket_ttl sweep only runs inside call
on the next exchange, which never arrives after consumer exit.
Trait Implementations§
Source§impl Clone for AggregatorService
impl Clone for AggregatorService
Source§fn clone(&self) -> AggregatorService
fn clone(&self) -> AggregatorService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AggregatorService
impl Debug for AggregatorService
Source§impl Drop for AggregatorService
impl Drop for AggregatorService
Source§impl Service<Exchange> for AggregatorService
impl Service<Exchange> for AggregatorService
Source§type Error = CamelError
type Error = CamelError
Source§type Future = Pin<Box<dyn Future<Output = Result<Exchange, CamelError>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<Exchange, CamelError>> + Send>>
Source§fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), CamelError>>
fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), CamelError>>
Poll::Ready(Ok(())) when the service is able to process requests. Read moreSource§impl StepLifecycle for AggregatorService
impl StepLifecycle for AggregatorService
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Resets the sweep for a fresh lifecycle: replaces the cancellation token
with a new one and aborts any existing sweep handle so the next
poll_ready respawns the sweep bound to the new token.
fn shutdown<'life0, 'async_trait>(
&'life0 self,
reason: StepShutdownReason,
) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for AggregatorService
impl !UnwindSafe for AggregatorService
impl Freeze for AggregatorService
impl Send for AggregatorService
impl Sync for AggregatorService
impl Unpin for AggregatorService
impl UnsafeUnpin for AggregatorService
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<P> Processor for P
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
Source§fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
Source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
Source§fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
Service, calling it with the provided request once it is ready.Source§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
poll_ready method. Read moreSource§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
poll_ready method. Read moreSource§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
poll_ready method. Read moreSource§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Result<Self::Response, Self::Error>)
to a different value, regardless of whether the future succeeds or
fails. Read more