pub struct BrokerConfig {Show 16 fields
pub callback_port_range: (u16, u16),
pub event_timeout: Duration,
pub polling_activation_delay: Duration,
pub base_polling_interval: Duration,
pub max_polling_interval: Duration,
pub subscription_timeout: Duration,
pub event_buffer_size: usize,
pub max_concurrent_polls: usize,
pub enable_proactive_firewall_detection: bool,
pub firewall_event_wait_timeout: Duration,
pub enable_firewall_caching: bool,
pub max_cached_device_states: usize,
pub max_registrations: usize,
pub adaptive_polling: bool,
pub renewal_threshold: Duration,
pub force_polling_mode: bool,
}Expand description
Configuration for the EventBroker
This struct controls all aspects of the event broker’s behavior, from callback server settings to polling intervals and firewall detection.
Fields§
§callback_port_range: (u16, u16)Port range for the callback server Default: (3400, 3500)
event_timeout: DurationTimeout for detecting event failures (fallback after proactive detection) Default: 30 seconds
polling_activation_delay: DurationDelay after proactive firewall detection before activating polling Default: 5 seconds
base_polling_interval: DurationBase interval for polling operations Default: 5 seconds
max_polling_interval: DurationMaximum interval for adaptive polling Default: 30 seconds
subscription_timeout: DurationTimeout for UPnP subscriptions Default: 1800 seconds (30 minutes)
event_buffer_size: usizeBuffer size for event channels Default: 1000
max_concurrent_polls: usizeMaximum number of concurrent polling tasks Default: 50
enable_proactive_firewall_detection: boolEnable proactive firewall detection Default: true
firewall_event_wait_timeout: DurationTimeout for waiting for first event to determine firewall status Default: 15 seconds
enable_firewall_caching: boolEnable per-device firewall detection caching Default: true
max_cached_device_states: usizeMaximum number of cached device firewall states Default: 100
max_registrations: usizeMaximum number of registrations allowed Default: 1000
adaptive_polling: boolEnable adaptive polling intervals based on change frequency Default: true
renewal_threshold: DurationThreshold for subscription renewal (time before expiration) Default: 5 minutes
force_polling_mode: boolForce polling mode — skip UPnP subscriptions and go straight to polling Simulates a firewall that blocks all callback traffic. Useful for testing. Default: false
Implementations§
Source§impl BrokerConfig
impl BrokerConfig
Sourcepub fn fast_polling() -> Self
pub fn fast_polling() -> Self
Create a BrokerConfig optimized for fast polling fallback
Sourcepub fn resource_efficient() -> Self
pub fn resource_efficient() -> Self
Create a BrokerConfig optimized for resource efficiency
Sourcepub fn no_firewall_detection() -> Self
pub fn no_firewall_detection() -> Self
Create a BrokerConfig with firewall detection disabled
Sourcepub fn firewall_simulation() -> Self
pub fn firewall_simulation() -> Self
Create a BrokerConfig that simulates a firewall by forcing polling mode Useful for testing firewall fallback behavior without a real firewall
Sourcepub fn validate(&self) -> Result<(), BrokerError>
pub fn validate(&self) -> Result<(), BrokerError>
Validate the configuration and return any issues
Sourcepub fn with_callback_ports(self, start: u16, end: u16) -> Self
pub fn with_callback_ports(self, start: u16, end: u16) -> Self
Builder pattern methods for fluent configuration
pub fn with_polling_interval(self, base: Duration, max: Duration) -> Self
pub fn with_event_timeout(self, timeout: Duration) -> Self
pub fn with_buffer_size(self, size: usize) -> Self
pub fn with_firewall_detection(self, enabled: bool) -> Self
pub fn with_force_polling(self, enabled: bool) -> Self
Trait Implementations§
Source§impl Clone for BrokerConfig
impl Clone for BrokerConfig
Source§fn clone(&self) -> BrokerConfig
fn clone(&self) -> BrokerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more