Interface ReactiveSessionCallback<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
ReactiveSession
. Allows to execute any number of
operations on a single ReactiveSession
, using any type and number of Statements.
This is particularly useful for delegating to existing data access code that expects a ReactiveSession
to
work on and throws DriverException
. For newly written code, it is strongly recommended to use
CqlTemplate
's more specific operations, for example a query or update variant.
- Since:
- 2.0
- Author:
- Mark Paluch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<T>
doInSession
(ReactiveSession session) Gets called byReactiveCqlTemplate.execute(ReactiveSessionCallback)
with an active Cassandra session.
-
Method Details
-
doInSession
org.reactivestreams.Publisher<T> doInSession(ReactiveSession session) throws com.datastax.oss.driver.api.core.DriverException, DataAccessException Gets called byReactiveCqlTemplate.execute(ReactiveSessionCallback)
with an active Cassandra session. Does not need to care about activating or closing theReactiveSession
.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(Statement, Class)
etc. A thrownRuntimeException
is treated as application exception: it gets propagated to the caller of the template.- Parameters:
session
- active Cassandra session.- 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:
-