Interface ReactiveStatementCallback<T>
- Type Parameters:
T
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Generic callback interface for code that operates on a CQL
Statement
. Allows to execute any number of
operations on a single Statement
, for example a single ReactiveSession.execute(Statement)
.
Used internally by ReactiveCqlTemplate
, but also useful for application code.
- Since:
- 2.0
- Author:
- Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<T>
doInStatement
(ReactiveSession session, com.datastax.oss.driver.api.core.cql.Statement<?> stmt) Gets called byReactiveCqlTemplate.execute(String)
with an active Cassandra session.
-
Method Details
-
doInStatement
org.reactivestreams.Publisher<T> doInStatement(ReactiveSession session, com.datastax.oss.driver.api.core.cql.Statement<?> stmt) throws com.datastax.oss.driver.api.core.DriverException, DataAccessException Gets called byReactiveCqlTemplate.execute(String)
with an active Cassandra session. Does not need to care about closing the the session: this will all be handled by Spring'sReactiveCqlTemplate
.Allows for returning a result object created within the callback, i.e. a domain object or a collection of domain objects. Note that there's special support for single step actions: see
ReactiveCqlTemplate.queryForObject(String, Class, Object...)
etc. A thrown RuntimeException is treated as application exception, it gets propagated to the caller of the template.- Parameters:
session
- active Cassandra session.stmt
- CQL Statement.- Returns:
- a result object publisher.
- Throws:
com.datastax.oss.driver.api.core.DriverException
- if thrown by a session method, to be auto-converted to aDataAccessException
DataAccessException
- in case of custom exceptions- See Also:
-