rrq-protocol
Protocol definitions for communication between the RRQ orchestrator and runner processes.
Overview
This crate defines the wire protocol used for socket communication between:
- RRQ Orchestrator - dispatches jobs to runner processes
- RRQ Runner - receives and executes job handlers
The protocol uses length-prefixed JSON frames over TCP connections.
Installation
[]
= "0.9"
Protocol Messages
ExecutionRequest
Sent from orchestrator to runner when dispatching a job:
use ;
let request = ExecutionRequest ;
ExecutionOutcome
Returned from runner to orchestrator after job execution:
use ExecutionOutcome;
// Success
let outcome = success;
// Failure
let outcome = failure;
// Retry after delay
let outcome = retry_after;
CancelRequest
Sent to runner to cancel an in-flight job:
use CancelRequest;
let cancel = CancelRequest ;
Frame Encoding
Messages are encoded as length-prefixed JSON:
┌─────────────────┬──────────────────────────────┐
│ Length (4B) │ JSON Payload (N bytes) │
│ Big-endian u32 │ UTF-8 encoded │
└─────────────────┴──────────────────────────────┘
use ;
let message = Request ;
let frame: = encode_frame?;
// frame = [length_bytes...][json_bytes...]
Runner Message Envelope
All messages are wrapped in an RunnerMessage enum:
use RunnerMessage;
// Three variants:
let msg = Request ;
let msg = Response ;
let msg = Cancel ;
Outcome Types
The outcome_type field indicates how the job completed:
| Type | Description |
|---|---|
success |
Job completed successfully |
failure |
Job failed (may retry) |
handler_not_found |
No handler registered for function |
timeout |
Job exceeded deadline |
cancelled |
Job was cancelled |
retry_after |
Retry after specified delay |
Related Crates
| Crate | Description |
|---|---|
rrq |
Job queue orchestrator |
rrq-producer |
Client for enqueuing jobs |
rrq-runner |
Runner runtime implementation |
License
Apache-2.0