pub struct HttpConfig {Show 21 fields
pub url: String,
pub path: Option<String>,
pub method: Option<String>,
pub tls: TlsConfig,
pub workers: Option<usize>,
pub message_id_header: Option<String>,
pub request_timeout_ms: Option<u64>,
pub internal_buffer_size: Option<usize>,
pub fire_and_forget: bool,
pub receive_streamable: bool,
pub inline_response_fast_path: Option<bool>,
pub server_protocol: HttpServerProtocol,
pub stream_response_to: Option<Box<Endpoint>>,
pub batch_concurrency: Option<usize>,
pub tcp_keepalive_ms: Option<u64>,
pub pool_idle_timeout_ms: Option<u64>,
pub compression_enabled: bool,
pub compression_threshold_bytes: Option<usize>,
pub concurrency_limit: Option<usize>,
pub basic_auth: Option<(String, String)>,
pub custom_headers: HashMap<String, String>,
}Expand description
General HTTP connection configuration.
Fields§
§url: StringFor consumers, the listen address (e.g., “0.0.0.0:8080”). For publishers, the target URL.
path: Option<String>(Consumer only) Optional request path filter. If set, only requests whose URI path matches exactly are delivered to this consumer.
method: Option<String>(Optional) HTTP method. For publishers: the method to use (defaults to POST). For consumers: restrict to this method (others return 405).
tls: TlsConfigTLS configuration.
workers: Option<usize>(Consumer only) Number of worker threads to use. Defaults to 0 for unlimited.
message_id_header: Option<String>(Consumer only) Header key to extract the message ID from. Defaults to “message-id”.
request_timeout_ms: Option<u64>Timeout for HTTP requests in milliseconds. For consumers, it’s the request-reply timeout. For publishers, it’s the timeout for each individual request. Defaults to 30000ms.
internal_buffer_size: Option<usize>(Consumer only) Internal buffer size for the channel. Defaults to 100.
fire_and_forget: bool(Consumer only) If true, respond immediately with 202 Accepted without waiting for downstream processing. Defaults to false.
receive_streamable: bool(Consumer only) If true, read request bodies as a stream and emit each received stream item as a separate message.
inline_response_fast_path: Option<bool>(Consumer only) If true, compatible http -> response routes may bypass the normal route consumer/worker/disposition pipeline
and reply inline for lower latency. Defaults to true. Set to false to force the normal route path.
server_protocol: HttpServerProtocol(Consumer only) Restrict which HTTP protocol versions a server listener accepts.
Defaults to auto (HTTP/1.1 + HTTP/2). On cleartext listeners, http2_only
means HTTP/2 prior-knowledge (h2c) only.
stream_response_to: Option<Box<Endpoint>>(Publisher only) Optional endpoint that receives streamed HTTP response items as correlated messages.
Use a stream_buffer endpoint here when callers need to read streamed
response items later through a normal mq-bridge consumer. Each streamed
item is published with correlation_id, http_stream_id,
http_stream_index, http_stream_format, and http_stream_end
metadata. If the request message has no correlation_id, the HTTP
publisher uses format!("{:032x}", request.message_id) so callers can
derive the consumer correlation id before calling send.
batch_concurrency: Option<usize>(Publisher only) The number of concurrent HTTP requests to send in a batch. Defaults to 20.
tcp_keepalive_ms: Option<u64>(Publisher only) TCP keepalive timeout for the underlying connection pool in milliseconds. Defaults to 60000ms.
pool_idle_timeout_ms: Option<u64>(Publisher only) Timeout for idle connections in the connection pool in milliseconds. Defaults to 90000ms.
compression_enabled: boolEnable gzip compression for request/response bodies exceeding the threshold. Defaults to false.
compression_threshold_bytes: Option<usize>Minimum message size in bytes to compress. Messages smaller than this are sent uncompressed. Defaults to 1024 bytes.
concurrency_limit: Option<usize>HTTP Basic Authentication credentials (username, password). For consumers: validates incoming requests. For publishers: adds Authorization header. (Consumer only) Maximum number of concurrent requests to handle. Defaults to 100.
basic_auth: Option<(String, String)>§custom_headers: HashMap<String, String>Custom headers as key-value pairs (e.g., {“X-API-Key”: “token123”}). Added to outgoing HTTP headers for both consumers and publishers.
Implementations§
Source§impl HttpConfig
impl HttpConfig
Sourcepub fn new(url: impl Into<String>) -> Self
pub fn new(url: impl Into<String>) -> Self
Creates a new HTTP configuration with the specified URL.
pub fn with_workers(self, workers: usize) -> Self
pub fn with_method(self, method: impl Into<String>) -> Self
pub fn with_path(self, path: impl Into<String>) -> Self
pub fn with_receive_streamable(self, receive_streamable: bool) -> Self
pub fn with_inline_response_fast_path( self, inline_response_fast_path: bool, ) -> Self
pub fn with_server_protocol(self, server_protocol: HttpServerProtocol) -> Self
pub fn inline_response_fast_path_enabled(&self) -> bool
pub fn with_stream_response_to(self, endpoint: Endpoint) -> Self
Trait Implementations§
Source§impl Clone for HttpConfig
impl Clone for HttpConfig
Source§fn clone(&self) -> HttpConfig
fn clone(&self) -> HttpConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more