Class CassandraSessionFactory

java.lang.Object
io.micronaut.cassandra.CassandraSessionFactory
All Implemented Interfaces:
AutoCloseable

@Factory public class CassandraSessionFactory extends Object implements AutoCloseable
Creates cassandra cluster for each configuration bean.
Since:
1.0
Author:
Nirav Assar, Michael Pollind, Dean Wette
  • Constructor Summary

    Constructors
    Constructor
    Description
    CassandraSessionFactory(io.micronaut.core.value.PropertyResolver propertyResolver)
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.datastax.oss.driver.api.core.CqlSession
    cassandraCluster(com.datastax.oss.driver.api.core.CqlSessionBuilder builder)
    Creates the CqlSession bean for the given configuration.
    void
    closes all active CqlSession.
    com.datastax.oss.driver.api.core.CqlSessionBuilder
    Creates the CqlSessionBuilder bean for the given configuration.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 the CqlSessionBuilder 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 the CqlSession bean for the given configuration.
      Parameters:
      builder - The CqlSessionBuilder
      Returns:
      A CqlSession bean
    • close

      @PreDestroy public void close()
      closes all active CqlSession.
      Specified by:
      close in interface AutoCloseable