Skip to content

CassandraJournalOptions

Defined in: src/persistence/journals/CassandraJournal.ts:14

readonly optional allIdsTable?: string

Defined in: src/persistence/journals/CassandraJournal.ts:20

Lookup table for persistenceIds(). Default: all_persistence_ids.


readonly optional autoCreateKeyspace?: boolean

Defined in: src/persistence/journals/CassandraClient.ts:42

If true, create the keyspace on startup (simple strategy, rf=1). Dev-friendly default.

CassandraConnection.autoCreateKeyspace


readonly optional autoCreateTables?: boolean

Defined in: src/persistence/journals/CassandraJournal.ts:30

Auto-create the events/metadata/all-ids tables on first connect.


readonly optional client?: CassandraClientLike

Defined in: src/persistence/journals/CassandraJournal.ts:59

Inject a pre-built client instead of letting the journal instantiate cassandra-driver itself — useful for tests and when the host already owns the client lifecycle.


readonly optional consistency?: number

Defined in: src/persistence/journals/CassandraClient.ts:55

CQL consistency level to use for all reads and writes. Default: LOCAL_QUORUM (value 6 in the driver). Pass the numeric value from cassandra-driver’s types.consistencies.

CassandraConnection.consistency


readonly contactPoints: readonly string[]

Defined in: src/persistence/journals/CassandraClient.ts:32

Node(s) to seed the cluster topology from.

CassandraConnection.contactPoints


readonly optional credentials?: object

Defined in: src/persistence/journals/CassandraClient.ts:38

Optional username/password for PLAIN auth.

password: string

username: string

CassandraConnection.credentials


readonly optional eventsTable?: string

Defined in: src/persistence/journals/CassandraJournal.ts:16

Table name for events. Default: events.


readonly keyspace: string

Defined in: src/persistence/journals/CassandraClient.ts:36

Keyspace to USE after connect. Must already exist, or pass autoCreateKeyspace: true.

CassandraConnection.keyspace


readonly optional localDataCenter?: string

Defined in: src/persistence/journals/CassandraClient.ts:34

Local DC — required for DCAwareRoundRobinPolicy. Defaults to datacenter1.

CassandraConnection.localDataCenter


readonly optional metadataTable?: string

Defined in: src/persistence/journals/CassandraJournal.ts:18

Table tracking the highest sequence number per pid. Default: metadata.


readonly optional partitionSize?: number

Defined in: src/persistence/journals/CassandraJournal.ts:28

Rows per partition before rolling over to a new one. Keeps Cassandra partitions bounded. Default: 500_000 — a good balance between write amplification and read-scan cost for long-lived streams.


readonly optional port?: number

Defined in: src/persistence/journals/CassandraClient.ts:40

Port — defaults to 9042.

CassandraConnection.port


readonly optional replication?: object

Defined in: src/persistence/journals/CassandraClient.ts:44

Replication settings used by autoCreateKeyspace. Ignored otherwise.

readonly optional class?: "SimpleStrategy" | "NetworkTopologyStrategy"

readonly optional dataCenters?: Readonly<Record<string, number>>

For NetworkTopologyStrategy, map of DC → replication factor.

readonly optional replicationFactor?: number

CassandraConnection.replication


readonly optional tagIndexTable?: string

Defined in: src/persistence/journals/CassandraJournal.ts:22

Tag-index side table populated when useTagIndex is set. Default: events_by_tag.


readonly optional useTagIndex?: boolean

Defined in: src/persistence/journals/CassandraJournal.ts:53

Opt in to maintaining an events_by_tag side table for indexed eventsByTag queries (#44). When set, every append writes one extra row per (event, tag) pair to the side table inside the same batch as the primary events insert; CassandraQuery.currentEventsBy Tag then walks a single tag-partition instead of scanning the whole journal client-side.

Off by default to keep existing schemas compatible — operators opting in must run the side-table DDL on their cluster (the journal issues CREATE TABLE IF NOT EXISTS when autoCreateTables is also true; otherwise the DDL in CassandraClient.tagIndexDdl can be applied manually).

Caveat: delete(toSeq) does NOT propagate to the side table — deleting from events_by_tag would require either a secondary index on persistence_id or pre-reading the event’s tags (extra round-trips on the hot path). Operators with delete-heavy workloads should rely on Cassandra TTLs or accept stale tag entries (queries dedupe via the primary key, so they’re harmless — just storage overhead).