Custom push sender
Deliver notifications some other way than an HTTP POST, such as a queue, by implementing PushSender.
Implement the PushSender trait for custom delivery:
#![allow(unused)] fn main() { use std::future::Future; use std::pin::Pin; use a2a_protocol_sdk::prelude::*; use a2a_protocol_sdk::types::push::TaskPushNotificationConfig; mod aws_sdk_sqs { pub struct Client; } // stands in for the real crate use a2a_protocol_sdk::server::PushSender; struct SqsPushSender { client: aws_sdk_sqs::Client, } impl PushSender for SqsPushSender { fn send<'a>( &'a self, url: &'a str, event: &'a StreamResponse, config: &'a TaskPushNotificationConfig, ) -> Pin<Box<dyn Future<Output = A2aResult<()>> + Send + 'a>> { Box::pin(async move { // Send event to SQS instead of HTTP webhook Ok(()) }) } } }
A custom sender gets none of HttpPushSender's delivery-time checks or
retries. A sender that POSTs to the config's URL should resolve and screen it
with url_guard::resolve_public_addrs and connect to the addresses it returns,
not to the name (a client that looks the name up again at connect, as most do,
reopens DNS rebinding); should not follow redirects (a 3xx to an internal
address is the same attack by another route); and should send the notification
token and Authorization as the config specifies, and an A2A-Delivery-Id
(push::webhook::DELIVERY_ID_HEADER) that is the same on its retries. The handler still screens a URL when
the config is created, and bounds each send with push_delivery_timeout
(30 s). Override requires_https, allows_webhook_url and
max_delivery_duration when they apply.