How tq-ngo/kafka-go works
This is a small Kafka-like message-broker prototype. The main workflow is to start a broker, register producers and consumers for topics (and consumer groups), route producer messages into queues, then deliver queued messages to consumers that signal readiness. Topics, groups, partitions, and queues are distinct domain stages; the wire protocol and file-backed queue are useful internal layers. The README is empty, so capabilities and relationships here are based on the shown source; unsampled files are not assumed to add behavior.
Main entry points: broker.go Broker server · main.go Command entry · producer.go Producer client · consumer.go Consumer client
Components 12
Runtime and protocol
- Command entry
main.go - Broker server
broker.go - Wire messages
message.go - Producer client
producer.go - Consumer client
consumer.go
Message routing
- Topic registry
topic.go - Consumer groups
cgroup.go - Partitions
partition.go - Topic backlog
topic.go
Persistent storage
- Persistent queue
queue.go
Other components
- Process operator
- Local files
Connections 23
- Process operator → Command entry: starts process
main.go - Command entry → Broker server: starts broker
main.go - Command entry → Producer client: starts producer
main.go - Command entry → Consumer client: starts consumer
main.go - Producer client → Broker server: registers and sends
producer.go - Consumer client → Broker server: registers
consumer.go - Broker server → Producer client: connects for data
broker.go - Broker server → Consumer client: connects for delivery
broker.go - Producer client → Wire messages: encodes messages
producer.go - Consumer client → Wire messages: encodes messages
consumer.go - Broker server → Wire messages: reads and writes
broker.go - Broker server → Topic registry: initializes topics
broker.go - Broker server → Consumer groups: creates groups
broker.go - Broker server → Partitions: creates partitions
broker.go - Broker server → Topic backlog: buffers messages
broker.go - Broker server → Persistent queue: enqueues and dequeues
broker.go - Topic registry → Persistent queue: initializes backlog
topic.go - Consumer groups → Partitions: restores partitions
cgroup.go - Partitions → Persistent queue: initializes queue
partition.go - Broker server → Local files: stores topic metadata
broker.go - Topic registry → Local files: stores group metadata
topic.go - Consumer groups → Local files: stores partition metadata
cgroup.go - Persistent queue → Local files: maps queue files
queue.go