pub struct WebhookDispatcher { /* private fields */ }Expand description
Sends webhook events to all configured endpoints.
Implementations§
Source§impl WebhookDispatcher
impl WebhookDispatcher
Sourcepub fn new(configs: Vec<WebhookConfig>) -> Result<Arc<Self>, WebhookError>
pub fn new(configs: Vec<WebhookConfig>) -> Result<Arc<Self>, WebhookError>
Sourcepub fn with_service_name(
configs: Vec<WebhookConfig>,
service_name: &str,
) -> Result<Arc<Self>, WebhookError>
pub fn with_service_name( configs: Vec<WebhookConfig>, service_name: &str, ) -> Result<Arc<Self>, WebhookError>
Create with a custom service name.
§Errors
Returns WebhookError::InvalidUrl if any configured URL is empty.
Sourcepub async fn dispatch(&self, event: WebhookEvent)
pub async fn dispatch(&self, event: WebhookEvent)
Dispatch an event to all configured (non-backed-off) webhooks.
Delivery is attempted for each webhook sequentially. Failures are logged but do not propagate to the caller.
Sourcepub fn backed_off_count(&self) -> usize
pub fn backed_off_count(&self) -> usize
Return the number of configured webhooks currently in backoff.
Sourcepub fn webhook_count(&self) -> usize
pub fn webhook_count(&self) -> usize
Return the total number of configured webhooks.
Auto Trait Implementations§
impl !RefUnwindSafe for WebhookDispatcher
impl !UnwindSafe for WebhookDispatcher
impl Freeze for WebhookDispatcher
impl Send for WebhookDispatcher
impl Sync for WebhookDispatcher
impl Unpin for WebhookDispatcher
impl UnsafeUnpin for WebhookDispatcher
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request