pub struct WebhookAdapter { /* private fields */ }Expand description
Webhook transport adapter for HTTP POST delivery.
Delivers subscription events via HTTP POST with:
- HMAC-SHA256 signature (X-FraiseQL-Signature header)
- Exponential backoff retry logic
- Configurable timeouts
§Example
// Requires: live HTTP endpoint for webhook delivery.
use fraiseql_core::runtime::subscription::{
WebhookAdapter, WebhookTransportConfig, SubscriptionEvent, TransportAdapter,
};
let config = WebhookTransportConfig::new("https://api.example.com/webhooks")
.with_secret("my_secret_key")
.with_max_retries(3);
let adapter = WebhookAdapter::new(config)?;
adapter.deliver(&event, "orderCreated").await?;Implementations§
Source§impl WebhookAdapter
impl WebhookAdapter
Sourcepub fn new(config: WebhookTransportConfig) -> Result<Self, SubscriptionError>
pub fn new(config: WebhookTransportConfig) -> Result<Self, SubscriptionError>
Create a new webhook adapter.
§Errors
Returns an error if the URL targets a private/reserved IP (SSRF protection), or if the underlying HTTP client cannot be initialized.
Trait Implementations§
Source§impl Debug for WebhookAdapter
impl Debug for WebhookAdapter
Source§impl TransportAdapter for WebhookAdapter
impl TransportAdapter for WebhookAdapter
Source§fn deliver<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
event: &'life1 SubscriptionEvent,
subscription_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), SubscriptionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn deliver<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
event: &'life1 SubscriptionEvent,
subscription_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), SubscriptionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Deliver an event to the transport. Read more
Auto Trait Implementations§
impl Freeze for WebhookAdapter
impl !RefUnwindSafe for WebhookAdapter
impl Send for WebhookAdapter
impl Sync for WebhookAdapter
impl Unpin for WebhookAdapter
impl UnsafeUnpin for WebhookAdapter
impl !UnwindSafe for WebhookAdapter
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
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>
Converts
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>
Converts
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