Skip to main content

WebhookSourceConfig

Struct WebhookSourceConfig 

Source
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: String

Address 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: String

Endpoint path for receiving webhooks (default: "/webhook").

§max_payloads: Option<usize>

Stop after receiving this many payloads.

§timeout_secs: u64

How long to listen before returning, in seconds (default: 30).

§max_body_bytes: usize

Maximum 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: usize

Records 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

Source

pub fn new() -> Self

Create a new config with sensible defaults.

Source

pub fn listen_addr(self, addr: impl Into<String>) -> Self

Set the listen address.

Source

pub fn path(self, path: impl Into<String>) -> Self

Set the webhook endpoint path.

Source

pub fn max_payloads(self, max: usize) -> Self

Stop after receiving this many payloads.

Source

pub fn timeout_secs(self, secs: u64) -> Self

Set the timeout in seconds.

Source

pub fn max_body_bytes(self, bytes: usize) -> Self

Set the maximum accepted request body size in bytes.

Source

pub fn auth_token(self, token: impl Into<String>) -> Self

Require a shared-secret token in the Authorization header.

Source

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

Source§

fn clone(&self) -> WebhookSourceConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WebhookSourceConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WebhookSourceConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for WebhookSourceConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for WebhookSourceConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for WebhookSourceConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,