I am using SpringBoot with WebFlux and Spring data reactive cassandra. Making requests to Cassandra is all working but I notice that when the response comes back from the ReactiveCassandraOperations class, the code is left running on a thread from the cluster-nio-worker pool, which is maintained by the Datastax driver. This does not feel to be good practice as application code should not run on the thread pool of the Cassandra driver.
I would have thought that since this is all Spring WebFlux the classes used by spring-boot-starter-data-cassandra-reactive would leave the response to be handled on a thread from reactor-http-epoll thread pool, the default pool for handling requests.
In comparison, when making reactive http requests using the WebClient class, the code handling the response will be on the reactor-http-epoll thread pool.
Has anyone else experienced this issue or have any suggestions or recommendations ?
Code is using Spring Boot 2.1.7 along with that version of spring-boot-starter-data-cassandra-reactive and cassandra-driver-core 3.6.0
An example of code where this problem is mitigated by the use of elastic thread pool
@Override
public Mono<FailableResult<String>> getById(String hashId) {
return myCrudRepository.findById(hashId)
.map(MyResponseRow::getResponse)
.map(FailableResult::new)
.switchIfEmpty(Mono.empty())
.onErrorResume(DataAccessException.class, (error) -> Mono.just(new FailableResult<>(FailureReason.NOT_REACHABLE)))
.publishOn(Schedulers.elastic());
}