Path
The way of one stream entry through a RustStream service: the append, the group read, the
delivery, the handler, the reply and the XACK.
The diagram as text
- XADD a _payload field and h: fields → XREADGROUP up to 64 entries, on the read client
- XREADGROUP up to 64 entries, on the read client → RedisMessage fields become payload and headers
- RedisMessage fields become payload and headers → Dispatch the runtime's loop or its workers
- Dispatch the runtime's loop or its workers → Decode the payload into the handler's type
- Decode the payload into the handler's type → Handler async fn under #[subscriber]
- Handler async fn under #[subscriber] → Reply XADD on a pool connection
- Reply XADD on a pool connection → Settlement the outcome decides
- Settlement the outcome decides → XACK on a pool connection
A read returns up to 64 entries in one round trip, and the subscription hands them out one at a
time before it reads again. A batch handler reads as many entries as its batch size instead. When
the stream has nothing new, the read blocks for the subscription's block interval, five seconds
by default.
Each entry becomes a RedisMessage: the _payload field is
the payload, and each h: field a header. The runtime decodes the payload and calls the handler.
The reply is encoded and published with XADD on a pool connection, and the delivery settles
after it. A list read and a Pub/Sub message take the same way from the delivery on, with the
form's own settlement, which Settlement draws.