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:
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);
``` *
class CassandraClientFactory