cosmos-cassandra-go-extension

module
v0.0.0-...-96701e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2020 License: MIT

README

Go extension for Azure Cosmos DB Cassandra API

This is a small library that implements Retry Policy in the gocql Cassandra driver to intercept and handle Rate Limiting errors from the Cassandra API in Azure Cosmos DB. It resembles the implementation in the Azure Cosmos Cassandra Extensions for Java project

To use it, create an instance of the policy and associate it with the Query or the ClusterConfig (at a global level)

policy := retry.NewCosmosRetryPolicy(3)

....
//use it with cluster config
clusterConfig := gocql.NewCluster(cosmosCassandraContactPoint)
clusterConfig.RetryPolicy = retry.NewCosmosRetryPolicy(3)

....
//or each query
err := cs.Query(insertQuery).Bind(id, amount, state, time.Now()).Retry(policy).Exec()

For an example of how to use this, please see this sample project - github.com/abhirockzz/cosmos-rate-limiting (coming soon)

Disclaimer: this is a purely experimental (personal) project and not an officially supported Microsoft library

TODO
  • failover/load-balancing extension

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL