T
- @FunctionalInterface public interface ReactiveSessionCallback<T>
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.
ReactiveCqlTemplate.execute(ReactiveSessionCallback)
Modifier and Type | Method and Description |
---|---|
org.reactivestreams.Publisher<T> |
doInSession(ReactiveSession session)
Gets called by
ReactiveCqlTemplate.execute(ReactiveSessionCallback) with an active Cassandra session. |
org.reactivestreams.Publisher<T> doInSession(ReactiveSession session) throws com.datastax.driver.core.exceptions.DriverException, DataAccessException
ReactiveCqlTemplate.execute(ReactiveSessionCallback)
with an active Cassandra session. Does
not need to care about activating or closing the ReactiveSession
.
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 thrown RuntimeException
is treated as
application exception: it gets propagated to the caller of the template.
session
- active Cassandra session.com.datastax.driver.core.exceptions.DriverException
- if thrown by a session method, to be auto-converted to a DataAccessException
.DataAccessException
- in case of custom exceptions.ReactiveCqlTemplate.execute(ReactivePreparedStatementCreator, ReactivePreparedStatementCallback)
Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.