#[derive(RactorClusterMessage)]
{
// Attributes available to this derive:
#[rpc]
}
Expand description
Derive ractor::Message for messages that can be sent over the network
Serializable messages have to have a few formatting requirements.
- All variants of the enum will be tagged based on their variant name, which is sent over-the-wire in order to decode which
variant was called. This is the
variantfield onractor::message::SerializedMessage::CastandCall. - All properties of the message MUST implement the
ractor::BytesConvertabletrait which means they supply ato_bytesandfrom_bytesmethod. Many types are pre-done for you inractor’s definition of the trait - For RPCs, the LAST argument must be the reply channel. Additionally the type of message the channel is expecting back must also implement
ractor::BytesConvertable - Lastly, for RPCs, they should additionally be decorated with
#[rpc]on each variant’s definition. This helps the macro identify that it is an RPC and will need port handler - For backwards compatibility, you can add new variants as long as you don’t rename variants until all nodes in the cluster are upgraded.