Is spring data cassandra thread safe?

47 Views Asked by At

That's the question, is spring data cassandra thread safe? I mean for instance, are the operations exposed by org.springframework.data.cassandra.repository.CassandraRepository interface thread safe? operations as insert, update, findById, etc... The org.springframework.data.cassandra.repository.CassandraRepository interface has an implementation class which is org.springframework.data.cassandra.repository.support.SimpleCassandraRepository, is org.springframework.data.cassandra.repository.support.SimpleCassandraRepository class thread safe also?

No tries, just a question about spring data cassandra thread safety

1

There are 1 best solutions below

0
Chakib DAII On

the CassandraTemplate and ReactiveCassandraTemplate are thread-safe and can be reused across multiple instances.

you can check here for more details: https://docs.spring.io/spring-data/cassandra/reference/cassandra/template.html

and SimpleCassandraRepository (and its reactive variant SimpleReactiveCassandraRepository) use CassandraOperations (and ReactiveCassandraOperations for the reactive variant) to perform Cassandra operations and the default implementation is CassandraTemplate (and ReactiveCassandraTemplate for the reactive variant) which will be injected and used by the repositories dynamic proxy.

So SimpleCassandraRepository (and its reactive variant SimpleReactiveCassandraRepository) are thread-safe in term of performing operations.