Expand description
Shared reconnection/backoff policy for networked components.
Provides NetworkRetryPolicy (config struct), retry_async (execution helper),
and retry_async_cancelable (cancellation-aware variant). Components that
supervise external processes (JMS, xj, xslt) should use only
NetworkRetryPolicy::delay_for inside their own supervision loops.
Both retry_async and retry_async_cancelable accept an optional
label for component identity in retry logs:
use camel_component_api::retry_async;
retry_async(&config.reconnect, Some("ws-producer"), op, is_retryable).await?;When a label is set, log messages include "ws-producer: transient error — retrying" with a component structured field that operators can filter
with component=ws-producer.
For location-specific context (URLs, endpoints), wrap the retry call in a
tracing::span
whose fields are inherited by all log events inside the retry loop:
let span = tracing::info_span!("ws_connect", url = %url);
let _guard = span.enter();
retry_async(&config.reconnect, Some("ws-producer"), op, is_retryable).await?;Structs§
- Network
Retry Policy - Reconnection and backoff policy for networked components.
Functions§
- is_
retryable_ camel_ error - Classify a
CamelErroras retryable (transient network/IO errors). - retry_
async - Executes
opwith reconnect/backoff according topolicy. - retry_
async_ cancelable - Like
retry_asyncbut honours aCancellationTokenduring inter-retry sleep.