Module negotiation

Module negotiation 

Source
Expand description

Protocol version negotiation and detection

This module provides utilities for detecting and negotiating Celery protocol versions between CeleRS and Python Celery workers/clients.

§Protocol Versions

  • Protocol v1: Legacy format (Celery 3.x and earlier) - Not supported
  • Protocol v2: Current stable format (Celery 4.x+) - Fully supported
  • Protocol v5: Extended format (Celery 5.x+) - Fully supported

§Example

use celers_protocol::negotiation::{ProtocolNegotiator, negotiate_protocol};
use celers_protocol::ProtocolVersion;

// Negotiate between supported versions
let negotiator = ProtocolNegotiator::new()
    .prefer(ProtocolVersion::V5)
    .support(ProtocolVersion::V2);

let agreed = negotiator.negotiate(&[ProtocolVersion::V2]).unwrap();
assert_eq!(agreed, ProtocolVersion::V2);

Structs§

ProtocolCapabilities
Protocol capabilities
ProtocolDetection
Protocol detection result
ProtocolNegotiator
Protocol negotiator for version agreement

Enums§

DetectionMethod
Method used for protocol detection
NegotiationError
Protocol negotiation error

Functions§

detect_protocol
Detect protocol version from a JSON message
detect_protocol_from_bytes
Detect protocol version from message bytes
negotiate_protocol
Simple negotiation helper function