Quickstart
Build es from source, start a broker on your machine, and write and read records with the CLI. Or let one command do all of it, including a restart, retention and compaction.
Before you start
- A Rust toolchain. The repository pins the version in
rust-toolchain.toml;rustupinstalls it on first build. - A free port on localhost. The examples use
9000; the demo script uses9876(change it withES_PORT).
Run the demo
make demo
The script runs these steps and stops at the first failure. It ends with DEMO OK.
Reset. Deletes
./dataso every run starts the same way.Build. Compiles the workspace in release mode.
Start the broker with
--segment-bytes 1024, a deliberately tiny segment size, and waits for/healthz.Produce 200 records into
orders, two partitions. The small segments make several rolls per partition visible ines topic describe.Consume through a group. Group
analyticsreads five records and commits offset 5.Restart. Stops the broker, starts it again, and checks the group resumes at offset 5.
Retention and compaction. A topic with a 1.5-second retention loses its old segments; a compacted topic keeps only the latest value per key.
Run it by hand
Start a broker in one terminal:
cargo build --release ./target/release/es-broker \ --data-dir ./data \ --bind 127.0.0.1:9000
Then create a topic, write a record and read it back in another:
export ES_BROKER=http://127.0.0.1:9000 ./target/release/es topic create --name orders --partitions 2 ./target/release/es produce --topic orders --key k1 --value '{"id":1}' ./target/release/es consume --topic orders --partition 0 --offset 0
The record lands on the partition its key hashes to, so with two partitions it may be in partition 1.
es topic describe --name orders shows each partition's end offset.
Call the HTTP API directly
Everything the CLI does is a plain HTTP call:
curl -s -X POST localhost:9000/topics/orders/produce \ -H 'content-type: application/json' \ -d '{"records":[{"key":"k2","value":"hello"}]}' curl -s 'localhost:9000/topics/orders/consume?partition=0&offset=0'
Run the tests
The suite boots real brokers on ephemeral ports and drives them over HTTP, the binary protocol and the Raft transport: durability and recovery, retention and compaction, auth and quotas, consumer groups, replication and snapshot catch-up.
cargo test --workspace