pub struct WebhookSourceConfig {
pub listen_addr: String,
pub path: String,
pub max_payloads: Option<usize>,
pub timeout_secs: u64,
pub max_body_bytes: usize,
pub auth_token: Option<String>,
pub batch_size: usize,
}Expand description
Configuration for the webhook receiver source.
Fields§
§listen_addr: StringAddress to bind the HTTP server to (default: "127.0.0.1:8080").
Security: the default binds to loopback only. Binding to
0.0.0.0 exposes the receiver to the whole network — only do so
behind a trusted gateway, and set auth_token to require a shared
secret on every request.
path: StringEndpoint path for receiving webhooks (default: "/webhook").
max_payloads: Option<usize>Stop after receiving this many payloads.
timeout_secs: u64How long to listen before returning, in seconds (default: 30).
max_body_bytes: usizeMaximum accepted request body size in bytes (default: 1 MiB). Larger
POSTs are rejected with 413 Payload Too Large so a single huge
request can’t exhaust memory.
auth_token: Option<String>Optional shared secret. When set, every request must carry it in the
Authorization header (either the raw token or Bearer <token>);
requests without it are rejected with 401 Unauthorized. When None
(default) the endpoint is unauthenticated.
batch_size: usizeRecords per emitted StreamPage. The webhook
source has no native streaming primitive — it accumulates incoming POSTs
into an in-memory buffer during the receive window, then the default
Source::stream_pages impl chunks
that buffer into pages of this size. Defaults to DEFAULT_BATCH_SIZE.
batch_size = 0 is the “no batching” sentinel: the entire flush window
is emitted in a single page. For this source it is functionally
equivalent to any positive value larger than the received payload count
— the server-side buffering behaviour does not change.
Implementations§
Source§impl WebhookSourceConfig
impl WebhookSourceConfig
Sourcepub fn listen_addr(self, addr: impl Into<String>) -> Self
pub fn listen_addr(self, addr: impl Into<String>) -> Self
Set the listen address.
Sourcepub fn max_payloads(self, max: usize) -> Self
pub fn max_payloads(self, max: usize) -> Self
Stop after receiving this many payloads.
Sourcepub fn timeout_secs(self, secs: u64) -> Self
pub fn timeout_secs(self, secs: u64) -> Self
Set the timeout in seconds.
Sourcepub fn max_body_bytes(self, bytes: usize) -> Self
pub fn max_body_bytes(self, bytes: usize) -> Self
Set the maximum accepted request body size in bytes.
Sourcepub fn auth_token(self, token: impl Into<String>) -> Self
pub fn auth_token(self, token: impl Into<String>) -> Self
Require a shared-secret token in the Authorization header.
Sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Set the per-page record count for
Source::stream_pages.
Pass 0 to opt out of batching — the entire flush window is emitted in
a single StreamPage. The webhook source’s
server-side buffering is unaffected; only the downstream chunking
changes.
Trait Implementations§
Source§impl Clone for WebhookSourceConfig
impl Clone for WebhookSourceConfig
Source§fn clone(&self) -> WebhookSourceConfig
fn clone(&self) -> WebhookSourceConfig
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 WebhookSourceConfig
impl Debug for WebhookSourceConfig
Source§impl Default for WebhookSourceConfig
impl Default for WebhookSourceConfig
Source§impl<'de> Deserialize<'de> for WebhookSourceConfigwhere
WebhookSourceConfig: Default,
impl<'de> Deserialize<'de> for WebhookSourceConfigwhere
WebhookSourceConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for WebhookSourceConfig
impl JsonSchema for WebhookSourceConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more