Transports
Redis carries messages three ways: a stream keeps entries for consumer groups, a list hands each entry to one consumer, a channel keeps nothing.
The diagram as text
- XADD → Stream keeps every entry
- LPUSH → List until popped
- PUBLISH → Channel keeps nothing
- Stream keeps every entry → Group billing
- Stream keeps every entry → Group audit
- List until popped → Consumers take turns
- Channel keeps nothing → Client A
- Channel keeps nothing → Client B
- Joins later: never sees it
- Each group reads every entry
- Each entry goes to one consumer
A stream is an append-only log. XADD appends an entry under an id the server assigns, and the
entry stays until the stream is trimmed. A consumer group reads the stream with a cursor of its
own, so two groups each receive every entry. Inside one group, each entry goes to one consumer.
Groups draws how a group tracks what it delivered.
A list is a queue. A producer pushes with LPUSH, a consumer pops from the other end, and a
popped entry is gone from Redis. Queues draws how a reliable list keeps an entry until
its handler settles it.
A channel stores nothing. PUBLISH pushes a message to the clients subscribed at that moment, and
a client that subscribes later never sees it. Broadcast draws it.
A service reads each transport through its own descriptor:
RedisStream,
RedisList and
RedisPubSub. The handler is the same
#[subscriber] function on all three. What an acknowledgement means differs, as
Settlement draws.