Skip to main content

Identifiable

Trait Identifiable 

Source
pub trait Identifiable {
    // Required method
    fn get_id(&self) -> String;

    // Provided method
    fn partition_key(&self) -> String { ... }
}
Expand description

Trait for objects that can be uniquely identified for compensation purposes.

Required Methods§

Source

fn get_id(&self) -> String

Provided Methods§

Source

fn partition_key(&self) -> String

MQ partition key: decides which partition / stream shard / consumer a message is routed to, used for account affinity (session stickiness + tasks for the same account landing on the same node within the cluster).

Defaults to the same value as get_id (no affinity, random distribution); TaskEvent overrides it with the account, so that tasks for one account land on the same partition consistently via hash(account), reusing Kafka/NATS consumer group assignment to achieve cross-node consumer affinity. It is independent of get_id, which is used for deduplication / compensation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§