Your first stream
You will write a small program that publishes records to a durable stream and a second mode of the same program that reads them back. The reader remembers the last offset it handled in a file, so after you stop it and start it again it carries on with the first record it has not seen.
Prerequisites
Section titled “Prerequisites”A running broker and the environment variables from the tutorials overview. That page starts the development stack from the quickstart and writes the broker address, a token and the broker’s certificate to an env file you source in each terminal. You also need the client for your language, set up as the overview’s “Set up once” tabs describe. The steps show Rust, Python, TypeScript and C#. The C client is callback based, so its version is one program at the end.
1. Create a stream
Section titled “1. Create a stream”A stream has to exist before anything can publish to it. Create one with
felixctl:
docker compose run --rm felixctl stream create tutorial-eventspodman compose run --rm felixctl stream create tutorial-eventsWith an installed felixctl, drop the docker compose run --rm felixctl or
podman compose run --rm felixctl prefix. A new stream is durable: its records are written to disk before the
broker acknowledges them, and each one gets an offset, its position in the
stream’s log. Offsets only grow, and they are what lets a reader say where it
stopped.
2. Connect
Section titled “2. Connect”The program takes one argument, publish or read. This part is shared by
both. The broker address, token and certificate come from the environment, so
none of them is written into the code, and every call to the broker has a time
limit (see Time limits).
use std::future::Future;use std::net::SocketAddr;use std::sync::Arc;use std::time::Duration;
use anyhow::{Context, Result};use felix_client::{ClientConfig, Client, quic_client_config, root_store_from_pem_file};
// Must match FELIX_AUTH_TENANT.const TENANT: &str = "dev";const NAMESPACE: &str = "default";const STREAM: &str = "tutorial-events";
// Every call to the broker gets this long.const CALL_TIMEOUT: Duration = Duration::from_secs(10);
async fn bounded<T>(what: &str, limit: Duration, call: impl Future<Output = Result<T>>) -> Result<T> { tokio::time::timeout(limit, call) .await .with_context(|| format!("{what} did not finish within {limit:?}"))?}
async fn connect() -> Result<Arc<Client>> { let ca_file = std::env::var("FELIX_CA_FILE").context("set FELIX_CA_FILE")?; let roots = Arc::new(root_store_from_pem_file(&ca_file)?); // Reads FELIX_AUTH_TENANT and FELIX_AUTH_TOKEN. let config = ClientConfig::from_env_or_yaml(quic_client_config(Some(roots), false)?, None)?;
let broker = std::env::var("FELIX_BROKERS").unwrap_or_else(|_| "127.0.0.1:5000".into()); let seeds: Vec<SocketAddr> = vec![broker.parse().context("FELIX_BROKERS must be ip:port")?]; let connecting = Client::connect(&seeds, "localhost", config); let client = bounded("connecting", CALL_TIMEOUT, connecting).await?; Ok(Arc::new(client))}import asyncioimport osimport sysfrom pathlib import Path
import felix
# Must match FELIX_AUTH_TENANT.TENANT = "dev"NAMESPACE = "default"STREAM = "tutorial-events"
# Every call to the broker gets this long. `extra` is for a call that waits on# purpose.CALL_TIMEOUT = 10.0
async def bounded(call, extra=0.0): return await asyncio.wait_for(call, CALL_TIMEOUT + extra)
async def connect() -> felix.AsyncClient: return await bounded( felix.AsyncClient.connect( os.environ.get("FELIX_BROKERS", "127.0.0.1:5000"), tenant_id=TENANT, token=os.environ["FELIX_AUTH_TOKEN"], ca_file=os.environ["FELIX_CA_FILE"], ) )import { setTimeout as sleep } from "node:timers/promises";import { open, readFile, rename } from "node:fs/promises";import { Client, type Event, type StartPosition, type SubscriptionHandle,} from "felix-client";
// Must match FELIX_AUTH_TENANT.const TENANT = "dev";const NAMESPACE = "default";const STREAM = "tutorial-events";
// Every call to the broker gets this long. The client takes no timeout// argument, so a timer is raced against the call.const CALL_TIMEOUT_MS = 10_000;
async function bounded<T>(what: string, call: Promise<T>, ms = CALL_TIMEOUT_MS): Promise<T> { const timer = new AbortController(); const expired = sleep(ms, undefined, { signal: timer.signal }).then(() => { throw new Error(`${what} did not finish within ${ms} ms`); }); try { return await Promise.race([call, expired]); } finally { timer.abort(); }}
function required(name: string): string { const value = process.env[name]; if (!value) throw new Error(`set ${name}`); return value;}
function connect(): Promise<Client> { return bounded( "connecting", Client.connect(process.env.FELIX_BROKERS ?? "127.0.0.1:5000", TENANT, { token: required("FELIX_AUTH_TOKEN"), caFile: required("FELIX_CA_FILE"), }), );}using System.Text;using Felix;
// Must match FELIX_AUTH_TENANT.const string Tenant = "dev";const string Namespace = "default";const string StreamName = "tutorial-events";
// Every call to the broker gets this long.const int CallSeconds = 10;
static async Task<T> Bounded<T>(Func<CancellationToken, Task<T>> call){ using var limit = new CancellationTokenSource(TimeSpan.FromSeconds(CallSeconds)); return await call(limit.Token);}
static string Required(string name) => Environment.GetEnvironmentVariable(name) is { Length: > 0 } value ? value : throw new InvalidOperationException($"set {name}");
static Task<FelixClient> ConnectAsync() => Bounded(ct => FelixClient.ConnectAsync(new FelixClientOptions { Addrs = [Environment.GetEnvironmentVariable("FELIX_BROKERS") ?? "127.0.0.1:5000"], TenantId = Tenant, Token = Required("FELIX_AUTH_TOKEN"), CaFile = Required("FELIX_CA_FILE"), }, ct));The broker makes its own certificate, which is why a CA file is passed. A broker with a certificate from a public CA needs none.
3. Publish
Section titled “3. Publish”Each publish waits for the broker’s acknowledgement, which on a durable stream comes after the record is on disk. It returns the offset the record was written at.
use felix_client::AckMode;
async fn publish_three(client: &Client) -> Result<()> { for i in 1..=3 { let payload = format!("event {i}").into_bytes(); let publish = client.publish(TENANT, NAMESPACE, STREAM, payload, AckMode::PerMessage); let offset = bounded("publish", CALL_TIMEOUT, publish) .await? .context("a durable stream returns an offset")?; println!("published event {i} at offset {offset}"); } Ok(())}async def publish_three(client: felix.AsyncClient) -> None: for i in range(1, 4): offset = await bounded(client.publish(TENANT, NAMESPACE, STREAM, f"event {i}".encode())) print(f"published event {i} at offset {offset}")async function publishThree(client: Client): Promise<void> { for (let i = 1; i <= 3; i++) { const offset = await bounded( "publish", client.publish(TENANT, NAMESPACE, STREAM, Buffer.from(`event ${i}`)), ); console.log(`published event ${i} at offset ${offset}`); }}static async Task PublishThreeAsync(FelixClient client){ for (var i = 1; i <= 3; i++) { long? offset = await Bounded(ct => client.PublishAsync( Tenant, Namespace, StreamName, Encoding.UTF8.GetBytes($"event {i}"), cancellationToken: ct)); Console.WriteLine($"published event {i} at offset {offset}"); }}4. Read, and remember where you stopped
Section titled “4. Read, and remember where you stopped”A subscription starts at the tail of the stream unless you say otherwise. The reader asks for a start position instead: the beginning the first time, and the offset after the last one it handled on every run after that. A start offset is the first record you have not seen, so a resuming reader passes the last offset plus one.
The reader saves the offset after it has handled the record. If it dies between handling and saving, the record comes again on the next run, so whatever a handler does should be safe to repeat. The reader also stops after three idle seconds so the tutorial ends on its own; a service would keep reading.
use std::path::Path;
use felix_client::StartPosition;use tokio::io::AsyncWriteExt;
async fn load_checkpoint(path: &Path) -> Result<Option<u64>> { match tokio::fs::read_to_string(path).await { Ok(text) => Ok(Some(text.trim().parse().context("the checkpoint is not an offset")?)), Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(None), Err(err) => Err(err).context("read the checkpoint"), }}
// Sync a temporary file and rename it over the checkpoint, so a crash leaves// the old checkpoint or the new one, never half of one.async fn save_checkpoint(path: &Path, offset: u64) -> Result<()> { let tmp = path.with_extension("tmp"); let mut file = tokio::fs::File::create(&tmp).await.context("create the checkpoint")?; file.write_all(offset.to_string().as_bytes()).await.context("write the checkpoint")?; file.sync_all().await.context("sync the checkpoint")?; drop(file); tokio::fs::rename(&tmp, path).await.context("replace the checkpoint")}
async fn read_new(client: &Arc<Client>, checkpoint: &Path) -> Result<()> { let start = match load_checkpoint(checkpoint).await? { Some(offset) => StartPosition::Offset(offset + 1), None => StartPosition::Earliest, }; let subscribe = client.subscribe_from(TENANT, NAMESPACE, STREAM, Some(start)); let mut events = bounded("subscribe", CALL_TIMEOUT, subscribe).await?;
loop { match tokio::time::timeout(Duration::from_secs(3), events.next_event()).await { Err(_) => { println!("nothing new for 3 seconds, stopping"); return Ok(()); } Ok(Err(err)) => return Err(err), Ok(Ok(None)) => { println!("the subscription ended"); return Ok(()); } Ok(Ok(Some(event))) => { let offset = event.offset.context("the stream has no offsets; is it durable?")?; println!("offset {offset}: {}", String::from_utf8_lossy(&event.payload)); save_checkpoint(checkpoint, offset).await?; } } }}def load_checkpoint(path: Path) -> int | None: try: return int(path.read_text()) except FileNotFoundError: return None
# Sync a temporary file and rename it over the checkpoint, so a crash leaves# the old checkpoint or the new one, never half of one.def save_checkpoint(path: Path, offset: int) -> None: tmp = path.with_suffix(".tmp") with open(tmp, "w") as file: file.write(str(offset)) file.flush() os.fsync(file.fileno()) tmp.replace(path)
async def read_new(client: felix.AsyncClient, checkpoint: Path) -> None: saved = load_checkpoint(checkpoint) start = "earliest" if saved is None else saved + 1 subscribe = client.subscribe(TENANT, NAMESPACE, STREAM, start=start) async with await bounded(subscribe) as events: while (event := await events.next_event(timeout=3.0)) is not None: if event.offset is None: raise RuntimeError("the stream has no offsets; is it durable?") print(f"offset {event.offset}: {event.payload.decode(errors='replace')}") save_checkpoint(checkpoint, event.offset) # next_event returns None both when the wait times out and when the # subscription ends. if await events.closed: print("the subscription ended") else: print("nothing new for 3 seconds, stopping")async function loadCheckpoint(path: string): Promise<bigint | null> { try { return BigInt((await readFile(path, "utf8")).trim()); } catch (err) { if ((err as NodeJS.ErrnoException).code === "ENOENT") return null; throw err; }}
// Sync a temporary file and rename it over the checkpoint, so a crash leaves// the old checkpoint or the new one, never half of one.async function saveCheckpoint(path: string, offset: bigint): Promise<void> { const file = await open(`${path}.tmp`, "w"); try { await file.writeFile(offset.toString()); await file.sync(); } finally { await file.close(); } await rename(`${path}.tmp`, path);}
// The next event, null when the subscription ends, or "idle" after `ms`.async function nextWithin( events: SubscriptionHandle, ms: number,): Promise<Event | null | "idle"> { const timer = new AbortController(); try { return await Promise.race([ events.nextEvent(), sleep(ms, "idle" as const, { signal: timer.signal }), ]); } finally { timer.abort(); }}
async function readNew(client: Client, checkpoint: string): Promise<void> { const saved = await loadCheckpoint(checkpoint); const start: StartPosition = saved === null ? "earliest" : saved + 1n; const events = await bounded( "subscribe", client.subscribe(TENANT, NAMESPACE, STREAM, start), ); try { for (;;) { const event = await nextWithin(events, 3000); if (event === "idle") { console.log("nothing new for 3 seconds, stopping"); return; } if (event === null) { console.log("the subscription ended"); return; } if (event.offset === null) throw new Error("the stream has no offsets; is it durable?"); console.log(`offset ${event.offset}: ${event.payload.toString()}`); await saveCheckpoint(checkpoint, event.offset); } } finally { await events.close(); }}static async Task<long?> LoadCheckpointAsync(string path) => File.Exists(path) ? long.Parse((await File.ReadAllTextAsync(path)).Trim()) : null;
// Sync a temporary file and move it over the checkpoint, so a crash leaves the// old checkpoint or the new one, never half of one.static async Task SaveCheckpointAsync(string path, long offset){ await using (var file = new FileStream(path + ".tmp", FileMode.Create, FileAccess.Write)) { await file.WriteAsync(Encoding.UTF8.GetBytes(offset.ToString())); file.Flush(flushToDisk: true); } File.Move(path + ".tmp", path, overwrite: true);}
static async Task ReadNewAsync(FelixClient client, string checkpoint){ long? saved = await LoadCheckpointAsync(checkpoint); var start = saved is { } last ? StartPosition.FromOffset((ulong)(last + 1)) : StartPosition.Earliest; await using var events = await Bounded(ct => client.SubscribeAsync(Tenant, Namespace, StreamName, shard: 0, start, ct));
try { while (await Bounded(ct => events.ReadAsync(TimeSpan.FromSeconds(3), ct)) is { } ev) { if (ev.Offset is not { } offset) { throw new InvalidOperationException("the stream has no offsets; is it durable?"); } Console.WriteLine($"offset {offset}: {Encoding.UTF8.GetString(ev.Payload.Span)}"); await SaveCheckpointAsync(checkpoint, offset); } Console.WriteLine("nothing new for 3 seconds, stopping"); } catch (FelixException e) when (e.Status == FelixStatus.Closed) { Console.WriteLine("the subscription ended"); }}5. Pick the mode
Section titled “5. Pick the mode”The last part picks the mode from the command line.
use anyhow::bail;
#[tokio::main]async fn main() -> Result<()> { let client = connect().await?; match std::env::args().nth(1).as_deref() { Some("publish") => publish_three(&client).await, Some("read") => read_new(&client, Path::new("checkpoint")).await, _ => bail!("usage: first_stream publish|read"), }}async def main() -> None: mode = sys.argv[1] if len(sys.argv) > 1 else "" if mode not in ("publish", "read"): sys.exit("usage: first_stream.py publish|read") async with await connect() as client: if mode == "publish": await publish_three(client) else: await read_new(client, Path("checkpoint"))
asyncio.run(main())async function main(): Promise<void> { const mode = process.argv[2]; if (mode !== "publish" && mode !== "read") { throw new Error("usage: first-stream publish|read"); } const client = await connect(); try { if (mode === "publish") await publishThree(client); else await readNew(client, "checkpoint"); } finally { client.close(); }}
await main();var mode = args.Length > 0 ? args[0] : "";if (mode is not ("publish" or "read")){ Console.Error.WriteLine("usage: dotnet run -- publish|read"); return 1;}
await using var client = await ConnectAsync();if (mode == "publish"){ await PublishThreeAsync(client);}else{ await ReadNewAsync(client, "checkpoint");}return 0;Run it
Section titled “Run it”The program takes one argument, publish or read. Run each in a terminal where you have run source /path/to/felix-tutorial.env from the overview. The reader writes its checkpoint file to the directory you run it from, so run both from the same one.
From the project directory:
# publish three recordscargo run --bin first_stream -- publish# read them backcargo run --bin first_stream -- readWith the virtual environment active:
# publish three recordspython3 first_stream.py publish# read them backpython3 first_stream.py readFrom the project directory:
# publish three recordsnpx tsx first-stream.mts publish# read them backnpx tsx first-stream.mts readFrom the FirstStream directory:
# publish three recordsdotnet run -- publish# read them backdotnet run -- readBuild first-stream.c as the C section below shows, then run it from that directory:
# publish three records./first-stream publish# read them back./first-stream readWhat you should see
Section titled “What you should see”After publish, the program prints:
published event 1 at offset 1published event 2 at offset 2published event 3 at offset 3Your offsets may start somewhere else. A new stream’s first record is often
not at offset 0, because a leader writes a marker of its own first. After
read, it prints:
offset 1: event 1offset 2: event 2offset 3: event 3nothing new for 3 seconds, stoppingRun read again and it prints only the idle line, because checkpoint
holds 3 and the reader asked to start at 4. Run publish and then read again, and
only the new records appear:
offset 4: event 1offset 5: event 2offset 6: event 3nothing new for 3 seconds, stoppingThe stream still holds all six. Delete the checkpoint file and the reader
starts from the beginning and prints every one of them. That is the difference
from a subscription that starts at the tail: a durable stream is a log you can
read from any retained offset, as many times as you like, until its retention
bound removes old records.
If read fails with a cursor error, the offset in your checkpoint is older than
the stream’s retention. See
A consumer that survives a restart
for how to handle that in a long-running reader.
Each C call returns at once and reports to a callback, so the program below
wraps each one in a small waiter that blocks until the callback has run or
ten seconds have passed. It
is the same two modes as above. See How calls work
for the model.
#define _POSIX_C_SOURCE 200809L
#include <errno.h>#include <pthread.h>#include <stdbool.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include <unistd.h>
#include "felix.h"
#define TENANT "dev"#define NAMESPACE "default"#define STREAM "tutorial-events"#define CHECKPOINT "checkpoint"
struct waiter { pthread_mutex_t mu; pthread_cond_t cv; bool done; FelixStatus status; void *handle; bool has_offset; uint64_t offset; char message[256];};
static void finish(struct waiter *w, FelixStatus status, const char *message, void *handle) { pthread_mutex_lock(&w->mu); w->done = true; w->status = status; w->handle = handle; snprintf(w->message, sizeof w->message, "%s", message ? message : ""); pthread_cond_signal(&w->cv); pthread_mutex_unlock(&w->mu);}
/* A refused call never runs its callback, so its error comes from the thread. A call the broker does not answer within limit_ms ends the program: its callback may still run later, so nothing it uses can be freed. */static FelixStatus wait_for_ms(struct waiter *w, FelixStatus started, long limit_ms) { if (started != FELIX_STATUS_OK) { snprintf(w->message, sizeof w->message, "%s", felix_last_error_message()); return started; } struct timespec deadline; clock_gettime(CLOCK_REALTIME, &deadline); deadline.tv_sec += limit_ms / 1000; deadline.tv_nsec += (limit_ms % 1000) * 1000000L; if (deadline.tv_nsec >= 1000000000L) { deadline.tv_sec++; deadline.tv_nsec -= 1000000000L; } pthread_mutex_lock(&w->mu); while (!w->done) { if (pthread_cond_timedwait(&w->cv, &w->mu, &deadline) == ETIMEDOUT) { fprintf(stderr, "no answer from the broker within %ld ms\n", limit_ms); exit(1); } } w->done = false; FelixStatus status = w->status; pthread_mutex_unlock(&w->mu); return status;}
/* Every call to the broker gets this long. */#define CALL_LIMIT_MS 10000#define wait_for(w, started) wait_for_ms((w), (started), CALL_LIMIT_MS)
static void on_connect(void *user_data, FelixStatus status, const char *message, FelixClient *client) { finish(user_data, status, message, client);}
static void on_publish(void *user_data, FelixStatus status, const char *message, bool has_offset, uint64_t offset) { struct waiter *w = user_data; w->has_offset = has_offset; w->offset = offset; finish(w, status, message, NULL);}
static void on_subscribe(void *user_data, FelixStatus status, const char *message, FelixSubscription *subscription) { finish(user_data, status, message, subscription);}
static void on_event(void *user_data, FelixStatus status, const char *message, FelixEvent *event) { finish(user_data, status, message, event);}
static int publish_three(const FelixClient *client, struct waiter *w) { for (int i = 1; i <= 3; i++) { char payload[32]; int len = snprintf(payload, sizeof payload, "event %d", i); FelixStatus status = wait_for( w, felix_client_publish(client, TENANT, NAMESPACE, STREAM, (const uint8_t *)payload, (size_t)len, NULL, 0, FELIX_ACK_PER_MESSAGE, FELIX_DELIVERY_AT_MOST_ONCE, NULL, on_publish, w)); if (status != FELIX_STATUS_OK) { fprintf(stderr, "publish: %s\n", w->message); return 1; } if (w->has_offset) { printf("published event %d at offset %llu\n", i, (unsigned long long)w->offset); } else { printf("published event %d\n", i); } } return 0;}
/* The offset in the checkpoint file, or false when there is none yet. */static bool load_checkpoint(uint64_t *offset) { FILE *f = fopen(CHECKPOINT, "r"); if (!f) return false; unsigned long long value = 0; bool ok = fscanf(f, "%llu", &value) == 1; fclose(f); *offset = value; return ok;}
/* Synced, then renamed over the checkpoint, so a crash leaves the old one or the new one, never half of one. */static bool save_checkpoint(uint64_t offset) { FILE *f = fopen(CHECKPOINT ".tmp", "w"); if (!f) return false; bool ok = fprintf(f, "%llu\n", (unsigned long long)offset) > 0; ok = ok && fflush(f) == 0 && fsync(fileno(f)) == 0; ok = (fclose(f) == 0) && ok; return ok && rename(CHECKPOINT ".tmp", CHECKPOINT) == 0;}
static int read_new(const FelixClient *client, struct waiter *w) { uint64_t saved = 0; bool resume = load_checkpoint(&saved); FelixSubscription *sub = NULL; int exit_code = 1;
FelixStatus status = wait_for( w, felix_client_subscribe(client, TENANT, NAMESPACE, STREAM, 0, resume ? FELIX_START_OFFSET : FELIX_START_EARLIEST, resume ? saved + 1 : 0, NULL, on_subscribe, w)); if (status != FELIX_STATUS_OK) { fprintf(stderr, "subscribe: %s\n", w->message); return 1; } sub = w->handle;
for (;;) { status = wait_for_ms(w, felix_subscription_next(sub, 3000, NULL, on_event, w), 3000 + CALL_LIMIT_MS); if (status == FELIX_STATUS_TIMEOUT) { printf("nothing new for 3 seconds, stopping\n"); exit_code = 0; break; } if (status == FELIX_STATUS_CLOSED) { printf("the subscription ended\n"); exit_code = 0; break; } if (status != FELIX_STATUS_OK) { fprintf(stderr, "read: %s\n", w->message); break; } FelixEvent *event = w->handle; uint64_t offset = 0; bool has_offset = false; const uint8_t *data = NULL; size_t len = 0; if (felix_event_offset(event, &offset, &has_offset) != FELIX_STATUS_OK || felix_event_payload(event, &data, &len) != FELIX_STATUS_OK || !has_offset) { fprintf(stderr, "the event has no offset or payload; is the stream durable?\n"); felix_event_free(event); break; } printf("offset %llu: %.*s\n", (unsigned long long)offset, (int)len, (const char *)data); felix_event_free(event); if (!save_checkpoint(offset)) { fprintf(stderr, "could not save the checkpoint\n"); break; } } felix_subscription_free(sub); return exit_code;}
int main(int argc, char **argv) { const char *token = getenv("FELIX_AUTH_TOKEN"); const char *ca_file = getenv("FELIX_CA_FILE"); const char *broker = getenv("FELIX_BROKERS"); if (argc < 2 || (strcmp(argv[1], "publish") != 0 && strcmp(argv[1], "read") != 0)) { fprintf(stderr, "usage: first-stream publish|read\n"); return 1; } if (!token || !*token || !ca_file || !*ca_file) { fprintf(stderr, "set FELIX_AUTH_TOKEN and FELIX_CA_FILE\n"); return 1; }
struct waiter w = {.done = false}; pthread_mutex_init(&w.mu, NULL); pthread_cond_init(&w.cv, NULL); int exit_code = 1;
FelixStatus status = wait_for( &w, felix_client_connect(broker && *broker ? broker : "127.0.0.1:5000", TENANT, token, "localhost", ca_file, NULL, on_connect, &w)); if (status != FELIX_STATUS_OK) { fprintf(stderr, "connect: %s\n", w.message); } else { FelixClient *client = w.handle; exit_code = strcmp(argv[1], "publish") == 0 ? publish_three(client, &w) : read_new(client, &w); /* Every call has completed, so no callback still holds &w. */ felix_client_free(client); } pthread_cond_destroy(&w.cv); pthread_mutex_destroy(&w.mu); return exit_code;}Save it as first-stream.c in the unpacked release directory from the
overview, and compile and link it there:
cc -std=c11 -pthread -I include first-stream.c -L lib -lfelix \ -Wl,-rpath,"$PWD/lib" -o first-streamThis links lib/libfelix.dylib on macOS. To build from source instead, see
the C client page. Run it with the commands in the C tab of
Run it.
Where next
Section titled “Where next”A work queue reads a stream as jobs, so each record goes to one worker and a failed one comes back. The Rust client page covers subscribing in more depth, including ranges and what to do when a subscription falls behind, and Durable storage explains how the log, offsets and retention fit together.
