Basic usage with Task semantics
Basic usage with Task semantics
import { EventLog, createInMemory } from "@anabranch/eventlog"; const connector = createInMemory(); const log = await EventLog.connect(connector).run(); const eventId = await log.append("users", { action: "created", userId: 123 }).run(); const events = await log.list("users").run();
Consuming events as a stream with auto-commit
Consuming events as a stream with auto-commit
const connector = createInMemory(); const log = await EventLog.connect(connector).run(); const { successes, errors } = await log .consume("users", "my-processor") .withConcurrency(5) .map(async (batch) => { for (const event of batch.events) { await processEvent(event.data); } }) .partition();