Skip to main content

ControllerConfig

Struct ControllerConfig 

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

RocketMQ home directory

Defaults to ROCKETMQ_HOME environment variable or current directory

§config_store_path: PathBuf

Configuration file storage path

Defaults to $HOME/controller/controller.properties

§controller_type: String

Controller type: “Raft”

Default: Raft Note: In Rust implementation, “Raft” uses OpenRaft.

§scan_not_active_broker_interval: u64

Interval of periodic scanning for non-active broker (milliseconds)

Default: 5000 (5 seconds)

§controller_thread_pool_nums: usize

Number of threads to handle broker or operation requests (like REGISTER_BROKER)

Default: 16

§controller_request_thread_pool_queue_capacity: usize

Capacity of queue to hold client requests

Default: 50000

§mapped_file_size: usize

Mapped file size for controller storage

Default: 1GB (1024 * 1024 * 1024)

§controller_store_path: String

Controller storage path

Default: empty string (will be set based on rocketmq_home)

§elect_master_max_retry_count: u32

Max retry count for electing master when failed because of network or system error

Default: 3

§enable_elect_unclean_master: bool

Whether the controller can elect a master which is not in the syncStateSet

Default: false

§is_process_read_event: bool

Whether process read event

Default: false

§notify_broker_role_changed: bool

Whether notify broker when its role changed

Default: true

§scan_inactive_master_interval: u64

Interval of periodic scanning for non-active master in each broker-set (milliseconds)

Default: 5000 (5 seconds)

§raft_scan_wait_timeout_ms: u64

Wait time after the first broker heartbeat before OpenRaft inactive scanning starts.

Default: 1000 (1 second), matching Java jRaftScanWaitTimeoutMs.

§metrics_exporter_type: MetricsExporterType

Metrics exporter type

Default: Disable

§metrics_grpc_exporter_target: String

Metrics gRPC exporter target address

§metrics_grpc_exporter_header: String

Metrics gRPC exporter header

§metric_grpc_exporter_time_out_in_mills: u64

Metric gRPC exporter timeout (milliseconds)

Default: 3000 (3 seconds)

§metric_grpc_exporter_interval_in_mills: u64

Metric gRPC exporter interval (milliseconds)

Default: 60000 (60 seconds)

§metric_logging_exporter_interval_in_mills: u64

Metric logging exporter interval (milliseconds)

Default: 10000 (10 seconds)

§metrics_prom_exporter_port: u16

Metrics Prometheus exporter port

Default: 5557

§metrics_prom_exporter_host: String

Metrics Prometheus exporter host

§metrics_label: String

Metrics label (CSV format: Key:Value,Key:Value)

Example: “instance_id:xxx,uid:xxx”

§metrics_in_delta: bool

Whether metrics are in delta mode

Default: false

§config_black_list: String

Configuration blacklist (configs that cannot be updated via command)

These configs can only be changed by restarting the process. Default: “configBlackList;configStorePath”

§node_id: u64

Node id for this controller process (optional in shared config)

§listen_addr: SocketAddr

Listen 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: u64

Election timeout (ms) used by Raft

§heartbeat_interval_ms: u64

Heartbeat interval (ms) used by Raft

§storage_path: String

Local storage path for controller artifacts

§storage_backend: StorageBackendType

Storage backend to use for local controller artifacts

§enable_elect_unclean_master_local: bool

Whether the controller may elect an unclean master on this node

Implementations§

Source§

impl ControllerConfig

Source

pub fn new() -> Self

Create a new ControllerConfig with default values

Source

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

Set RocketMQ home directory

Source

pub fn with_config_store_path(self, path: PathBuf) -> Self

Set configuration store path

Source

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

Set controller type

Source

pub fn with_scan_not_active_broker_interval(self, interval_ms: u64) -> Self

Set scan not active broker interval

Source

pub fn with_controller_thread_pool_nums(self, nums: usize) -> Self

Set controller thread pool size

Source

pub fn with_controller_request_queue_capacity(self, capacity: usize) -> Self

Set controller request queue capacity

Source

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

Set controller storage path

Source

pub fn with_mapped_file_size(self, size: usize) -> Self

Set mapped file size

Source

pub fn with_elect_master_max_retry_count(self, count: u32) -> Self

Set elect master max retry count

Source

pub fn with_enable_elect_unclean_master(self, enable: bool) -> Self

Enable or disable elect unclean master

Source

pub fn with_process_read_event(self, enable: bool) -> Self

Enable or disable process read event

Source

pub fn with_notify_broker_role_changed(self, enable: bool) -> Self

Enable or disable notify broker role changed

Source

pub fn with_scan_inactive_master_interval(self, interval_ms: u64) -> Self

Set scan inactive master interval

Source

pub fn with_raft_scan_wait_timeout_ms(self, timeout_ms: u64) -> Self

Set OpenRaft inactive-scan wait timeout.

Source

pub fn with_metrics_exporter_type( self, exporter_type: MetricsExporterType, ) -> Self

Set metrics exporter type

Source

pub fn with_metrics_grpc_exporter( self, target: impl Into<String>, header: impl Into<String>, ) -> Self

Set metrics gRPC exporter configuration

Source

pub fn with_metrics_prom_exporter( self, host: impl Into<String>, port: u16, ) -> Self

Set metrics Prometheus exporter configuration

Source

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

Set metrics label

Source

pub fn with_node_info(self, node_id: u64, listen_addr: SocketAddr) -> Self

Set node id and listen address for node-specific usage

Source

pub fn with_raft_peers(self, peers: Vec<RaftPeer>) -> Self

Set raft peers for bootstrapping

Source

pub fn with_controller_peers(self, peers: Vec<RaftPeer>) -> Self

Set controller remoting peers used for broker-facing metadata responses.

Source

pub fn with_election_timeout_ms(self, ms: u64) -> Self

Set election timeout (ms)

Source

pub fn with_heartbeat_interval_ms(self, ms: u64) -> Self

Set heartbeat interval (ms)

Source

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

Set local storage path for this node

Source

pub fn with_enable_elect_unclean_master_local(self, enable: bool) -> Self

Set whether to enable elect unclean master locally

Source

pub fn with_storage_backend(self, backend: StorageBackendType) -> Self

Set storage backend for this node

Source

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

Set configuration blacklist

Source

pub fn new_node(node_id: u64, listen_addr: SocketAddr) -> Self

Convenience constructor for a node-specific config (node id + listen addr)

Source

pub fn test_config() -> Self

Test config helper

Source

pub fn raft_addr_for(&self, node_id: u64) -> Option<SocketAddr>

Resolve the Raft RPC address for a node.

Source

pub fn local_raft_addr(&self) -> SocketAddr

Resolve the local Raft RPC address, falling back to the remoting address for legacy configs.

Source

pub fn controller_addr_for(&self, node_id: u64) -> Option<SocketAddr>

Resolve the broker-facing controller remoting address for a node.

Source

pub fn controller_peer_addrs(&self) -> Vec<SocketAddr>

Return the broker-facing controller remoting addresses that should be advertised.

Source

pub fn is_config_in_blacklist(&self, key: &str) -> bool

Check if a configuration key is in the blacklist

Source

pub fn validate(&self) -> Result<(), String>

Validate the configuration

Source

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

Source

pub async fn update( &mut self, properties: HashMap<String, String>, ) -> RocketMQResult<()>

Trait Implementations§

Source§

impl Clone for ControllerConfig

Source§

fn clone(&self) -> Self

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 ControllerConfig

Source§

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

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

impl Default for ControllerConfig

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for ControllerConfig

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 Serialize for ControllerConfig

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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: Sized + 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: Sized + 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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