CassandraJournalOptionsType
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Defined in: src/persistence/journals/CassandraJournalOptions.ts:5
Extends
Section titled “Extends”CassandraConnection.StoreSerializerOptionsBase
Properties
Section titled “Properties”allIdsTable?
Section titled “allIdsTable?”
readonlyoptionalallIdsTable?:string
Defined in: src/persistence/journals/CassandraJournalOptions.ts:11
Lookup table for persistenceIds(). Default: all_persistence_ids.
autoCreateKeyspace?
Section titled “autoCreateKeyspace?”
readonlyoptionalautoCreateKeyspace?:boolean
Defined in: src/persistence/journals/CassandraClient.ts:44
If true, create the keyspace on startup (simple strategy, rf=1). Dev-friendly default.
Inherited from
Section titled “Inherited from”CassandraConnection.autoCreateKeyspace
autoCreateTables?
Section titled “autoCreateTables?”
readonlyoptionalautoCreateTables?:boolean
Defined in: src/persistence/journals/CassandraJournalOptions.ts:21
Auto-create the events/metadata/all-ids tables on first connect.
client?
Section titled “client?”
readonlyoptionalclient?:CassandraClientLike
Defined in: src/persistence/journals/CassandraJournalOptions.ts:86
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.
consistency?
Section titled “consistency?”
readonlyoptionalconsistency?:number
Defined in: src/persistence/journals/CassandraClient.ts:57
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.
Inherited from
Section titled “Inherited from”CassandraConnection.consistency
contactPoints
Section titled “contactPoints”
readonlycontactPoints: readonlystring[]
Defined in: src/persistence/journals/CassandraClient.ts:34
Node(s) to seed the cluster topology from.
Inherited from
Section titled “Inherited from”CassandraConnection.contactPoints
credentials?
Section titled “credentials?”
readonlyoptionalcredentials?:object
Defined in: src/persistence/journals/CassandraClient.ts:40
Optional username/password for PLAIN auth.
password
Section titled “password”password:
string
username
Section titled “username”username:
string
Inherited from
Section titled “Inherited from”CassandraConnection.credentials
eventsTable?
Section titled “eventsTable?”
readonlyoptionaleventsTable?:string
Defined in: src/persistence/journals/CassandraJournalOptions.ts:7
Table name for events. Default: events.
keyspace
Section titled “keyspace”
readonlykeyspace:string
Defined in: src/persistence/journals/CassandraClient.ts:38
Keyspace to USE after connect. Must already exist, or pass autoCreateKeyspace: true.
Inherited from
Section titled “Inherited from”CassandraConnection.keyspace
lightweightTransactions?
Section titled “lightweightTransactions?”
readonlyoptionallightweightTransactions?:boolean
Defined in: src/persistence/journals/CassandraJournalOptions.ts:65
Serialize concurrent appends with a Cassandra lightweight
transaction (Paxos) that claims the sequence range on the metadata
row before any event is written (#475). Default: true.
Without it the append path is a plain read-modify-write: two writers
that both read head N both pass the expectedSeq check and both
INSERT at sequence_nr = N+1. A Cassandra INSERT is an upsert, so
the later write silently overwrites the earlier one and both callers
are told their event was persisted. The relational backends can’t lose
that race — their primary key rejects the loser — so the LWT is what
gives Cassandra the same JournalConcurrencyError contract.
The cost is one Paxos round-trip per append, not per event: the
claim is a single conditional statement on the metadata row, while the
events themselves still go out in the same unlogged per-partition
batch. Turn it off only if you genuinely guarantee a single writer per
persistence id and want that round-trip back — a losing concurrent
append then loses its event with no error.
localDataCenter?
Section titled “localDataCenter?”
readonlyoptionallocalDataCenter?:string
Defined in: src/persistence/journals/CassandraClient.ts:36
Local DC — required for DCAwareRoundRobinPolicy. Defaults to datacenter1.
Inherited from
Section titled “Inherited from”CassandraConnection.localDataCenter
metadataTable?
Section titled “metadataTable?”
readonlyoptionalmetadataTable?:string
Defined in: src/persistence/journals/CassandraJournalOptions.ts:9
Table tracking the highest sequence number per pid. Default: metadata.
partitionSize?
Section titled “partitionSize?”
readonlyoptionalpartitionSize?:number
Defined in: src/persistence/journals/CassandraJournalOptions.ts:19
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.
readonlyoptionalport?:number
Defined in: src/persistence/journals/CassandraClient.ts:42
Port — defaults to 9042.
Inherited from
Section titled “Inherited from”CassandraConnection.port
replication?
Section titled “replication?”
readonlyoptionalreplication?:object
Defined in: src/persistence/journals/CassandraClient.ts:46
Replication options used by autoCreateKeyspace. Ignored otherwise.
class?
Section titled “class?”
readonlyoptionalclass?:"SimpleStrategy"|"NetworkTopologyStrategy"
dataCenters?
Section titled “dataCenters?”
readonlyoptionaldataCenters?:Readonly<Record<string,number>>
For NetworkTopologyStrategy, map of DC → replication factor.
replicationFactor?
Section titled “replicationFactor?”
readonlyoptionalreplicationFactor?:number
Inherited from
Section titled “Inherited from”CassandraConnection.replication
serialConsistency?
Section titled “serialConsistency?”
readonlyoptionalserialConsistency?:number
Defined in: src/persistence/journals/CassandraJournalOptions.ts:80
Serial consistency for the LWT claim’s Paxos phase. Ignored when
lightweightTransactions is off. Pass the numeric value from
cassandra-driver’s types.consistencies — localSerial (9) or
serial (8).
Left unset the driver picks cluster-wide SERIAL, which needs a quorum
of replicas across every datacenter — so on a multi-DC keyspace each
append pays a cross-DC round-trip, quietly undoing the local-DC-only
write path that consistency: LOCAL_QUORUM buys. Set localSerial (9)
to keep Paxos inside the local DC, at the cost of losing linearizability
against writers in another DC (fine when a pid is only ever written from
one DC — the usual sharding layout).
serializer?
Section titled “serializer?”
readonlyoptionalserializer?:Serializer<unknown>
Defined in: src/persistence/storage/StoreSerializerOptions.ts:23
Custom payload serializer. When set, the store writes rows in the
self-describing __serialized__ framing (see PayloadCodec) instead
of the default tagged JSON; rows of both formats can coexist in one
stream, but reading a framed row back requires a serializer with the
same id to be configured.
Inherited from
Section titled “Inherited from”StoreSerializerOptionsBase.serializer
tagIndexTable?
Section titled “tagIndexTable?”
readonlyoptionaltagIndexTable?:string
Defined in: src/persistence/journals/CassandraJournalOptions.ts:13
Tag-index side table populated when useTagIndex is set. Default: events_by_tag.
useTagIndex?
Section titled “useTagIndex?”
readonlyoptionaluseTagIndex?:boolean
Defined in: src/persistence/journals/CassandraJournalOptions.ts:44
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).
