Package io.micronaut.cassandra
Class CassandraSessionFactory
java.lang.Object
io.micronaut.cassandra.CassandraSessionFactory
- All Implemented Interfaces:
AutoCloseable
Creates cassandra cluster for each configuration bean.
- Since:
- 1.0
- Author:
- Nirav Assar, Michael Pollind, Dean Wette
-
Constructor Summary
ConstructorDescriptionCassandraSessionFactory
(io.micronaut.core.value.PropertyResolver propertyResolver) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptioncom.datastax.oss.driver.api.core.CqlSession
cassandraCluster
(com.datastax.oss.driver.api.core.CqlSessionBuilder builder) Creates theCqlSession
bean for the given configuration.void
close()
closes all activeCqlSession
.com.datastax.oss.driver.api.core.CqlSessionBuilder
session
(CassandraConfiguration configuration) Creates theCqlSessionBuilder
bean for the given configuration.
-
Constructor Details
-
CassandraSessionFactory
public CassandraSessionFactory(io.micronaut.core.value.PropertyResolver propertyResolver) Default constructor.- Parameters:
propertyResolver
- Property resolve for application configurations
-
-
Method Details
-
session
@EachBean(CassandraConfiguration.class) public com.datastax.oss.driver.api.core.CqlSessionBuilder session(CassandraConfiguration configuration) Creates theCqlSessionBuilder
bean for the given configuration.- Parameters:
configuration
- The cassandra configuration bean- Returns:
- A
CqlSession
bean
-
cassandraCluster
@EachBean(com.datastax.oss.driver.api.core.CqlSessionBuilder.class) public com.datastax.oss.driver.api.core.CqlSession cassandraCluster(com.datastax.oss.driver.api.core.CqlSessionBuilder builder) Creates theCqlSession
bean for the given configuration.- Parameters:
builder
- TheCqlSessionBuilder
- Returns:
- A
CqlSession
bean
-
close
@PreDestroy public void close()closes all activeCqlSession
.- Specified by:
close
in interfaceAutoCloseable
-