sequence number
An increasing number attached to each message so the receiver can detect gaps, reorder messages and say where to resume.
In more detail
Include one whenever order matters or a client may need to catch up after a reconnect. Numbers must be assigned by the sender in the order it intends messages to be applied.
Related terms
- reconnection — Re-establishing a dropped long-lived connection and, where supported, resuming from the last message received.
- ordering guarantee — A promise about whether messages are processed in the order they were sent, which is often limited to one key or partition.
- Last-Event-ID — The header a Server-Sent Events client sends when reconnecting, carrying the id of the last event it received so the server can continue from there.
- idempotent producer — A producer mode in which the broker detects and discards duplicate batches caused by retries, so each record is written once per partition.
- producer ID — A number the broker assigns to an idempotent or transactional producer so it can recognise that producer's batches.
- sequence gap — A missing number in a series of sequence numbers, showing that an item was lost or delayed.
- monotonic — Only ever increasing, never going backwards or repeating.
- timestamp — A recorded date and time, usually stored in about eight bytes.
- clock skew — The difference between the times reported by clocks on different machines.
Taught in
- WebSockets — Modern API Architecture: REST, GraphQL & gRPC
- The Payment That Was Charged Twice — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- The Retry That Overtook — Confluent Apache Kafka Certifications (CCDAK and CCAAK) Exam Prep
- Idempotent Producers And Retries — Apache Kafka & Event Streaming
- Replication, Failover And Leader Election — Scalable System Design & Distributed Architecture
- Eventual Consistency And What It Costs A Product — Scalable System Design & Distributed Architecture
- Worked Design Two: A Global Chat System — Scalable System Design & Distributed Architecture
- Worked Design Two: Scaling Chat Fan Out — Scalable System Design & Distributed Architecture
- Worked Design Three: A Metrics Ingestion Pipeline — Scalable System Design & Distributed Architecture
References
- RFC 6455: The WebSocket Protocol
- Apache Kafka design: message delivery semantics
- PostgreSQL documentation: CREATE SEQUENCE
- Google Cloud Pub/Sub: Ordering messages