Provides a centralized and streamlined factory for creating and configuring instances of the Cassandra client. This class abstracts the complexities involved in instantiating and configuring Cassandra client instances, enabling straightforward integration with Cassandra databases. It supports customization through various configuration options, allowing for the creation of clients tailored to specific needs, such as connecting to different clusters or utilizing specialized authentication and connection options.

Key Features:

  • Simplifies the Cassandra client creation process with method-based configurations.
  • Supports customization for connecting to various Cassandra environments, including cloud-based services like Astra.
  • Ensures consistent and optimal client configuration, incorporating best practices.

Example Usage (Apache Cassandra®):

const cassandraArgs = {
contactPoints: ['h1', 'h2'],
localDataCenter: 'datacenter1',
credentials: {
username: <...> as string,
password: <...> as string,
},
};
const cassandraClient = CassandraClientFactory.getClient(cassandraArgs);

Example Usage (DataStax AstraDB):

const astraArgs = {
serviceProviderArgs: {
astra: {
token: <...> as string,
endpoint: <...> as string,
},
},
};
const cassandraClient = CassandraClientFactory.getClient(astraArgs);
``` *

Hierarchy

  • CassandraClientFactory

Constructors

Methods

Constructors

Methods

  • Asynchronously obtains a configured Cassandra client based on the provided arguments. This method processes the given CassandraClientArgs to produce a configured Client instance from the cassandra-driver, suitable for interacting with Cassandra databases.

    Parameters

    • args: CassandraClientArgs

      The configuration arguments for the Cassandra client, including any service provider-specific options.

    Returns Promise<Client>

    A Promise resolving to a Client object configured according to the specified arguments.

Generated using TypeDoc