1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/// Default maximum pending messages allowed per topic consumer group.
pub const DEFAULT_MQ_MAX_QUEUE_LEN: usize = 10_000;
/// Default unacknowledged delivery visibility timeout in milliseconds.
pub const DEFAULT_MQ_VISIBILITY_TIMEOUT_MS: u64 = 30_000;
/// Default maximum delivery attempts before routing a message to the dead-letter queue.
pub const DEFAULT_MQ_MAX_RETRIES: u32 = 3;
/// Default consumer group name used when no explicit groups are subscribed.
pub const DEFAULT_MQ_GROUP: &str = "default";
/// Default suffix appended to a topic name for its dead-letter queue.
pub const DEFAULT_MQ_DLQ_SUFFIX: &str = ".dlq";
/// Number of lock-striped shards for topic lookup tables in [`crate::InMemoryBroker`].
pub const MQ_SHARD_COUNT: usize = 64;
/// Sentinel slot index indicating the default consumer group has not been created yet.
pub const MQ_GROUP_UNSET: usize = usizeMAX;
/// Lock-free direct topic lookup table capacity before spilling to overflow vector.
pub const MQ_FAST_TOPIC_SLOTS: usize = 1024;
/// Number of lower bits reserved for per-receipt sequence inside `receipt_id`.
pub const MQ_RECEIPT_SEQ_BITS: u32 = 40;
/// Bitmask extracting the 40-bit sequence component of a `receipt_id`.
pub const MQ_RECEIPT_SEQ_MASK: u64 = - 1;
/// Multiplicative 64-bit mixing constant for fast word-at-a-time hashing.
pub const FX_HASH_K: u64 = 0x517c_c1b7_2722_0a95;
/// Fibonacci golden-ratio multiplier for 64-bit integer key hashing.
pub const FIB_HASH_K: u64 = 0x9e37_79b9_7f4a_7c15;
/// Error text returned when a consumer group queue reaches capacity.
pub const ERR_MQ_QUEUE_FULL: &str = "Message queue capacity exceeded";
/// Error text returned when an ack/nack references an unknown receipt id.
pub const ERR_MQ_UNKNOWN_DELIVERY: &str = "Unknown message delivery receipt";
/// Error text returned when the broker mutex is poisoned or closed.
pub const ERR_MQ_BROKER_CLOSED: &str = "Message broker is unavailable";
/// Error text returned when publishing an already-expired message.
pub const ERR_MQ_EXPIRED: &str = "Message already expired";