interface EventLogAdapter

Low-level adapter interface for event log implementations.

Adapters handle the actual communication with the underlying event store (in-memory, Kafka, etc.). Use connectors to create adapter instances.

Type Parameters

Cursor = string

Methods

append<T>(
topic: string,
data: T,
options?: AppendOptions,
): Promise<string>

Append an event to a topic.

consume<T>(
topic: string,
consumerGroup: string,
onBatch: (batch: EventBatch<T, Cursor>) => Promisable<void>,
onError: (error: EventLogConsumeFailed) => Promisable<void>,
): { close: () => Promise<void>; }

Consume events from a topic.

getCursor(
topic: string,
consumerGroup: string,
): Promise<Cursor | null>

Get the last committed cursor for a consumer group.

commitCursor(
topic: string,
consumerGroup: string,
cursor: Cursor,
): Promise<void>

Commit a cursor for a consumer group.

close(): Promise<void>

Close the adapter and release resources.

Usage

import { type EventLogAdapter } from ".";