pub struct ControllerConfig {Show 34 fields
pub rocketmq_home: String,
pub config_store_path: PathBuf,
pub controller_type: String,
pub scan_not_active_broker_interval: u64,
pub controller_thread_pool_nums: usize,
pub controller_request_thread_pool_queue_capacity: usize,
pub mapped_file_size: usize,
pub controller_store_path: String,
pub elect_master_max_retry_count: u32,
pub enable_elect_unclean_master: bool,
pub is_process_read_event: bool,
pub notify_broker_role_changed: bool,
pub scan_inactive_master_interval: u64,
pub raft_scan_wait_timeout_ms: u64,
pub metrics_exporter_type: MetricsExporterType,
pub metrics_grpc_exporter_target: String,
pub metrics_grpc_exporter_header: String,
pub metric_grpc_exporter_time_out_in_mills: u64,
pub metric_grpc_exporter_interval_in_mills: u64,
pub metric_logging_exporter_interval_in_mills: u64,
pub metrics_prom_exporter_port: u16,
pub metrics_prom_exporter_host: String,
pub metrics_label: String,
pub metrics_in_delta: bool,
pub config_black_list: String,
pub node_id: u64,
pub listen_addr: SocketAddr,
pub raft_peers: Vec<RaftPeer>,
pub controller_peers: Vec<RaftPeer>,
pub election_timeout_ms: u64,
pub heartbeat_interval_ms: u64,
pub storage_path: String,
pub storage_backend: StorageBackendType,
pub enable_elect_unclean_master_local: bool,
/* private fields */
}Fields§
§rocketmq_home: StringRocketMQ home directory
Defaults to ROCKETMQ_HOME environment variable or current directory
config_store_path: PathBufConfiguration file storage path
Defaults to $HOME/controller/controller.properties
controller_type: StringController type: “Raft”
Default: Raft Note: In Rust implementation, “Raft” uses OpenRaft.
scan_not_active_broker_interval: u64Interval of periodic scanning for non-active broker (milliseconds)
Default: 5000 (5 seconds)
controller_thread_pool_nums: usizeNumber of threads to handle broker or operation requests (like REGISTER_BROKER)
Default: 16
controller_request_thread_pool_queue_capacity: usizeCapacity of queue to hold client requests
Default: 50000
mapped_file_size: usizeMapped file size for controller storage
Default: 1GB (1024 * 1024 * 1024)
controller_store_path: StringController storage path
Default: empty string (will be set based on rocketmq_home)
elect_master_max_retry_count: u32Max retry count for electing master when failed because of network or system error
Default: 3
enable_elect_unclean_master: boolWhether the controller can elect a master which is not in the syncStateSet
Default: false
is_process_read_event: boolWhether process read event
Default: false
notify_broker_role_changed: boolWhether notify broker when its role changed
Default: true
scan_inactive_master_interval: u64Interval of periodic scanning for non-active master in each broker-set (milliseconds)
Default: 5000 (5 seconds)
raft_scan_wait_timeout_ms: u64Wait time after the first broker heartbeat before OpenRaft inactive scanning starts.
Default: 1000 (1 second), matching Java jRaftScanWaitTimeoutMs.
metrics_exporter_type: MetricsExporterTypeMetrics exporter type
Default: Disable
metrics_grpc_exporter_target: StringMetrics gRPC exporter target address
metrics_grpc_exporter_header: StringMetrics gRPC exporter header
metric_grpc_exporter_time_out_in_mills: u64Metric gRPC exporter timeout (milliseconds)
Default: 3000 (3 seconds)
metric_grpc_exporter_interval_in_mills: u64Metric gRPC exporter interval (milliseconds)
Default: 60000 (60 seconds)
metric_logging_exporter_interval_in_mills: u64Metric logging exporter interval (milliseconds)
Default: 10000 (10 seconds)
metrics_prom_exporter_port: u16Metrics Prometheus exporter port
Default: 5557
metrics_prom_exporter_host: StringMetrics Prometheus exporter host
metrics_label: StringMetrics label (CSV format: Key:Value,Key:Value)
Example: “instance_id:xxx,uid:xxx”
metrics_in_delta: boolWhether metrics are in delta mode
Default: false
config_black_list: StringConfiguration blacklist (configs that cannot be updated via command)
These configs can only be changed by restarting the process. Default: “configBlackList;configStorePath”
node_id: u64Node id for this controller process (optional in shared config)
listen_addr: SocketAddrListen address for RPC/raft on this node
raft_peers: Vec<RaftPeer>Peer list used for raft bootstrapping
controller_peers: Vec<RaftPeer>Controller remoting peer list used for broker-facing leader discovery
election_timeout_ms: u64Election timeout (ms) used by Raft
heartbeat_interval_ms: u64Heartbeat interval (ms) used by Raft
storage_path: StringLocal storage path for controller artifacts
storage_backend: StorageBackendTypeStorage backend to use for local controller artifacts
enable_elect_unclean_master_local: boolWhether the controller may elect an unclean master on this node
Implementations§
Source§impl ControllerConfig
impl ControllerConfig
Sourcepub fn with_rocketmq_home(self, path: impl Into<String>) -> Self
pub fn with_rocketmq_home(self, path: impl Into<String>) -> Self
Set RocketMQ home directory
Sourcepub fn with_config_store_path(self, path: PathBuf) -> Self
pub fn with_config_store_path(self, path: PathBuf) -> Self
Set configuration store path
Sourcepub fn with_controller_type(self, controller_type: impl Into<String>) -> Self
pub fn with_controller_type(self, controller_type: impl Into<String>) -> Self
Set controller type
Sourcepub fn with_scan_not_active_broker_interval(self, interval_ms: u64) -> Self
pub fn with_scan_not_active_broker_interval(self, interval_ms: u64) -> Self
Set scan not active broker interval
Sourcepub fn with_controller_thread_pool_nums(self, nums: usize) -> Self
pub fn with_controller_thread_pool_nums(self, nums: usize) -> Self
Set controller thread pool size
Sourcepub fn with_controller_request_queue_capacity(self, capacity: usize) -> Self
pub fn with_controller_request_queue_capacity(self, capacity: usize) -> Self
Set controller request queue capacity
Sourcepub fn with_controller_store_path(self, path: impl Into<String>) -> Self
pub fn with_controller_store_path(self, path: impl Into<String>) -> Self
Set controller storage path
Sourcepub fn with_mapped_file_size(self, size: usize) -> Self
pub fn with_mapped_file_size(self, size: usize) -> Self
Set mapped file size
Sourcepub fn with_elect_master_max_retry_count(self, count: u32) -> Self
pub fn with_elect_master_max_retry_count(self, count: u32) -> Self
Set elect master max retry count
Sourcepub fn with_enable_elect_unclean_master(self, enable: bool) -> Self
pub fn with_enable_elect_unclean_master(self, enable: bool) -> Self
Enable or disable elect unclean master
Sourcepub fn with_process_read_event(self, enable: bool) -> Self
pub fn with_process_read_event(self, enable: bool) -> Self
Enable or disable process read event
Sourcepub fn with_notify_broker_role_changed(self, enable: bool) -> Self
pub fn with_notify_broker_role_changed(self, enable: bool) -> Self
Enable or disable notify broker role changed
Sourcepub fn with_scan_inactive_master_interval(self, interval_ms: u64) -> Self
pub fn with_scan_inactive_master_interval(self, interval_ms: u64) -> Self
Set scan inactive master interval
Sourcepub fn with_raft_scan_wait_timeout_ms(self, timeout_ms: u64) -> Self
pub fn with_raft_scan_wait_timeout_ms(self, timeout_ms: u64) -> Self
Set OpenRaft inactive-scan wait timeout.
Sourcepub fn with_metrics_exporter_type(
self,
exporter_type: MetricsExporterType,
) -> Self
pub fn with_metrics_exporter_type( self, exporter_type: MetricsExporterType, ) -> Self
Set metrics exporter type
Sourcepub fn with_metrics_grpc_exporter(
self,
target: impl Into<String>,
header: impl Into<String>,
) -> Self
pub fn with_metrics_grpc_exporter( self, target: impl Into<String>, header: impl Into<String>, ) -> Self
Set metrics gRPC exporter configuration
Sourcepub fn with_metrics_prom_exporter(
self,
host: impl Into<String>,
port: u16,
) -> Self
pub fn with_metrics_prom_exporter( self, host: impl Into<String>, port: u16, ) -> Self
Set metrics Prometheus exporter configuration
Sourcepub fn with_metrics_label(self, label: impl Into<String>) -> Self
pub fn with_metrics_label(self, label: impl Into<String>) -> Self
Set metrics label
Sourcepub fn with_node_info(self, node_id: u64, listen_addr: SocketAddr) -> Self
pub fn with_node_info(self, node_id: u64, listen_addr: SocketAddr) -> Self
Set node id and listen address for node-specific usage
Sourcepub fn with_raft_peers(self, peers: Vec<RaftPeer>) -> Self
pub fn with_raft_peers(self, peers: Vec<RaftPeer>) -> Self
Set raft peers for bootstrapping
Sourcepub fn with_controller_peers(self, peers: Vec<RaftPeer>) -> Self
pub fn with_controller_peers(self, peers: Vec<RaftPeer>) -> Self
Set controller remoting peers used for broker-facing metadata responses.
Sourcepub fn with_election_timeout_ms(self, ms: u64) -> Self
pub fn with_election_timeout_ms(self, ms: u64) -> Self
Set election timeout (ms)
Sourcepub fn with_heartbeat_interval_ms(self, ms: u64) -> Self
pub fn with_heartbeat_interval_ms(self, ms: u64) -> Self
Set heartbeat interval (ms)
Sourcepub fn with_storage_path(self, path: impl Into<String>) -> Self
pub fn with_storage_path(self, path: impl Into<String>) -> Self
Set local storage path for this node
Sourcepub fn with_enable_elect_unclean_master_local(self, enable: bool) -> Self
pub fn with_enable_elect_unclean_master_local(self, enable: bool) -> Self
Set whether to enable elect unclean master locally
Sourcepub fn with_storage_backend(self, backend: StorageBackendType) -> Self
pub fn with_storage_backend(self, backend: StorageBackendType) -> Self
Set storage backend for this node
Sourcepub fn with_config_black_list(self, blacklist: impl Into<String>) -> Self
pub fn with_config_black_list(self, blacklist: impl Into<String>) -> Self
Set configuration blacklist
Sourcepub fn new_node(node_id: u64, listen_addr: SocketAddr) -> Self
pub fn new_node(node_id: u64, listen_addr: SocketAddr) -> Self
Convenience constructor for a node-specific config (node id + listen addr)
Sourcepub fn test_config() -> Self
pub fn test_config() -> Self
Test config helper
Sourcepub fn raft_addr_for(&self, node_id: u64) -> Option<SocketAddr>
pub fn raft_addr_for(&self, node_id: u64) -> Option<SocketAddr>
Resolve the Raft RPC address for a node.
Sourcepub fn local_raft_addr(&self) -> SocketAddr
pub fn local_raft_addr(&self) -> SocketAddr
Resolve the local Raft RPC address, falling back to the remoting address for legacy configs.
Sourcepub fn controller_addr_for(&self, node_id: u64) -> Option<SocketAddr>
pub fn controller_addr_for(&self, node_id: u64) -> Option<SocketAddr>
Resolve the broker-facing controller remoting address for a node.
Sourcepub fn controller_peer_addrs(&self) -> Vec<SocketAddr>
pub fn controller_peer_addrs(&self) -> Vec<SocketAddr>
Return the broker-facing controller remoting addresses that should be advertised.
Sourcepub fn is_config_in_blacklist(&self, key: &str) -> bool
pub fn is_config_in_blacklist(&self, key: &str) -> bool
Check if a configuration key is in the blacklist
Sourcepub fn to_properties_string(&self) -> String
pub fn to_properties_string(&self) -> String
Convert configuration to properties string format
Returns a string in properties format (key=value\n) using camelCase naming