Message Broker
Independent delivery state and bounded retries
A retained log owns messages once, while each consumer group owns its own cursor, attempt count and in-flight state. Acknowledging one group must not consume another group's delivery.
type GroupProgress struct { Position,Attempt int; InFlight bool }
a, b := GroupProgress{}, GroupProgress{}
a.Position++
fmt.Println(b.Position) // 0: independent cursorPolling an in-flight item repeats the same delivery; an explicit negative acknowledgment enables a new attempt. At the attempt limit, move the message to that group's dead letters exactly once and advance. Lifetime ID uniqueness is different from queue membership: consuming or dead-lettering a message must not permit its ID to be published again. This exercise has no timeout-driven redelivery.
Go models this service with a struct and pointer-receiver methods. Constructor functions return a pointer; validation failures return errors rather than panicking. Scalars in snapshot structs are copied by value. Maps, slices, and optional pointers still require detached copies when crossing the service boundary. Go maps do not have key iteration order; use ordered slices for ranked results. There are no threads, persistence, wall-clock reads, or external side effects in this exercise.
Put it into practice
Implement the exercise in a full-screen workspace, then run its tests.