object CassandraFlow
- Alphabetic
- By Inheritance
- CassandraFlow
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- def create[T](writeSettings: CassandraWriteSettings, cqlStatement: String, statementBinder: (T, PreparedStatement) => BoundStatement)(implicit session: CassandraSession): Flow[T, T, NotUsed]
A flow writing to Cassandra for every stream element.
A flow writing to Cassandra for every stream element. The element to be persisted is emitted unchanged.
- T
stream element type
- writeSettings
settings to configure the write operation
- cqlStatement
raw CQL statement
- statementBinder
function to bind data from the stream element to the prepared statement
- session
implicit Cassandra session from
CassandraSessionRegistry
- def createBatch[T, K](writeSettings: CassandraWriteSettings, cqlStatement: String, statementBinder: (T, PreparedStatement) => BoundStatement, groupingKey: (T) => K)(implicit session: CassandraSession): Flow[T, T, NotUsed]
Creates a flow that uses com.datastax.oss.driver.api.core.cql.BatchStatement and groups the elements internally into batches using the
writeSettings
and pergroupingKey
.Creates a flow that uses com.datastax.oss.driver.api.core.cql.BatchStatement and groups the elements internally into batches using the
writeSettings
and pergroupingKey
. Use this when most of the elements in the stream share the same partition key.Cassandra batches that share the same partition key will only resolve to one write internally in Cassandra, boosting write performance.
"A LOGGED batch to a single partition will be converted to an UNLOGGED batch as an optimization." (Batch CQL)
Be aware that this stage does NOT preserve the upstream order.
- T
stream element type
- K
extracted key type for grouping into batches
- writeSettings
settings to configure the batching and the write operation
- cqlStatement
raw CQL statement
- statementBinder
function to bind data from the stream element to the prepared statement
- groupingKey
groups the elements to go into the same batch
- session
implicit Cassandra session from
CassandraSessionRegistry
- def withContext[T, Ctx](writeSettings: CassandraWriteSettings, cqlStatement: String, statementBinder: (T, PreparedStatement) => BoundStatement)(implicit session: CassandraSession): FlowWithContext[T, Ctx, T, Ctx, NotUsed]
A flow writing to Cassandra for every stream element, passing context along.
A flow writing to Cassandra for every stream element, passing context along. The element (to be persisted) and the context are emitted unchanged.
- T
stream element type
- Ctx
context type
- writeSettings
settings to configure the write operation
- cqlStatement
raw CQL statement
- statementBinder
function to bind data from the stream element to the prepared statement
- session
implicit Cassandra session from
CassandraSessionRegistry