pub struct ServerConfig {Show 17 fields
pub concurrency: usize,
pub queues: HashMap<String, i32>,
pub strict_priority: bool,
pub task_check_interval: Duration,
pub delayed_task_check_interval: Duration,
pub shutdown_timeout: Duration,
pub health_check_interval: Duration,
pub group_grace_period: Duration,
pub group_max_delay: Option<Duration>,
pub group_max_size: Option<usize>,
pub janitor_interval: Duration,
pub janitor_batch_size: usize,
pub heartbeat_interval: Duration,
pub group_aggregator_enabled: bool,
pub periodic_task_manager_enabled: bool,
pub periodic_task_manager_check_interval: Duration,
pub acl_tenant: Option<String>,
}Expand description
服务器配置 Server configuration
Fields§
§concurrency: usize并发工作者数量 Number of concurrent workers
queues: HashMap<String, i32>队列配置,键为队列名称,值为优先级 Queue configuration, key is queue name, value is priority
strict_priority: bool是否使用严格优先级 Whether to use strict priority
task_check_interval: Duration任务检查间隔 Task check interval
delayed_task_check_interval: Duration延迟任务检查间隔 Delayed task check interval
shutdown_timeout: Duration关闭超时时间 Shutdown timeout
health_check_interval: Duration健康检查间隔 Health check interval
group_grace_period: Duration组宽限期 Group grace period
group_max_delay: Option<Duration>组最大延迟 Maximum group delay
group_max_size: Option<usize>组最大大小 Maximum group size
janitor_interval: Duration清理任务间隔 Janitor interval
janitor_batch_size: usize清理任务批量大小 Janitor batch size
heartbeat_interval: Duration心跳间隔 Heartbeat interval
group_aggregator_enabled: bool是否启用组聚合器 Whether to enable group aggregator
periodic_task_manager_enabled: bool是否启用周期性任务管理器 Whether to enable periodic task manager
periodic_task_manager_check_interval: Duration周期性任务管理器检查间隔 Periodic task manager check interval
acl_tenant: Option<String>ACL 租户名称(用户名),用作 ACL 前缀 ACL tenant name (username), used as ACL prefix When set, ACL feature is automatically enabled
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn concurrency(self, concurrency: usize) -> Self
pub fn concurrency(self, concurrency: usize) -> Self
设置并发数 Set the number of concurrent workers
Sourcepub fn strict_priority(self, strict: bool) -> Self
pub fn strict_priority(self, strict: bool) -> Self
设置严格优先级 Set strict priority
Sourcepub fn task_check_interval(self, interval: Duration) -> Self
pub fn task_check_interval(self, interval: Duration) -> Self
设置任务检查间隔 Set the task check interval
Sourcepub fn delayed_task_check_interval(self, interval: Duration) -> Self
pub fn delayed_task_check_interval(self, interval: Duration) -> Self
设置延迟任务检查间隔 Set the delayed task check interval
Sourcepub fn shutdown_timeout(self, timeout: Duration) -> Self
pub fn shutdown_timeout(self, timeout: Duration) -> Self
设置关闭超时时间 Set the shutdown timeout
Sourcepub fn health_check_interval(self, interval: Duration) -> Self
pub fn health_check_interval(self, interval: Duration) -> Self
设置健康检查间隔 Set the health check interval
Sourcepub fn group_grace_period(self, grace_period: Duration) -> Result<Self>
pub fn group_grace_period(self, grace_period: Duration) -> Result<Self>
设置组宽限期 Set the group grace period
Sourcepub fn group_max_delay(self, max_delay: Duration) -> Self
pub fn group_max_delay(self, max_delay: Duration) -> Self
设置组最大延迟 Set the maximum group delay
Sourcepub fn group_max_size(self, max_size: usize) -> Self
pub fn group_max_size(self, max_size: usize) -> Self
设置组最大大小 Set the maximum group size
Sourcepub fn janitor_interval(self, interval: Duration) -> Self
pub fn janitor_interval(self, interval: Duration) -> Self
设置清理任务间隔 Set the janitor interval
Sourcepub fn janitor_batch_size(self, batch_size: usize) -> Self
pub fn janitor_batch_size(self, batch_size: usize) -> Self
设置清理任务批量大小 Set the janitor batch size
Sourcepub fn enable_group_aggregator(self, enabled: bool) -> Self
pub fn enable_group_aggregator(self, enabled: bool) -> Self
启用组聚合器 Enable group aggregator
Sourcepub fn enable_periodic_task_manager(self, enabled: bool) -> Self
pub fn enable_periodic_task_manager(self, enabled: bool) -> Self
启用周期性任务管理器 Enable periodic task manager
Sourcepub fn periodic_task_manager_check_interval(self, interval: Duration) -> Self
pub fn periodic_task_manager_check_interval(self, interval: Duration) -> Self
设置周期性任务管理器检查间隔 Set periodic task manager check interval
Sourcepub fn acl_tenant<S: Into<String>>(self, tenant: S) -> Self
pub fn acl_tenant<S: Into<String>>(self, tenant: S) -> Self
设置 ACL 租户名称 Set ACL tenant name
当设置租户名称时,ACL 特性会自动启用,队列名称将自动添加租户前缀 When tenant name is set, ACL feature is automatically enabled and queue names will have the tenant prefix added
Sourcepub fn get_queue_name_with_prefix(&self, queue: &str) -> String
pub fn get_queue_name_with_prefix(&self, queue: &str) -> String
获取带 ACL 前缀的队列名称 Get queue name with ACL prefix
如果配置了租户,返回 {tenant:queue},否则返回原始队列名
If tenant is configured, returns {tenant:queue}, otherwise returns original queue name
注意:默认队列(DEFAULT_QUEUE_NAME)不添加前缀,这是所有租户共享的公共队列
Note: Default queue (DEFAULT_QUEUE_NAME) is not prefixed, it’s a shared public queue for all tenants
Sourcepub fn get_queues_with_prefix(&self) -> HashMap<String, i32>
pub fn get_queues_with_prefix(&self) -> HashMap<String, i32>
获取所有带 ACL 前缀的队列 Get all queues with ACL prefix
返回一个新的 HashMap,其中所有队列名称都添加了 ACL 前缀(如果配置了租户) Returns a new HashMap where all queue names have the ACL prefix added (if tenant is configured)
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more