GithubHelp home page GithubHelp logo

astra-sdk-java's Introduction

Astra Software Development Kit

License Apache2 Maven Central

Overview

This SDK (Software Development Kit) makes it easy to call Stargate and/or Astra services using idiomatic Java APIs.

  • The Stargate SDK works with both Stargate standalone installations and Stargate deployed in Astra. With standalone Stargate deployments you will initialize the framework with the class StargateClient and provide a list of nodes (IP). To start locally please follow Stargate SDK quickstart guide. The nodes will run in Docker.

  • The Astra SDK reuses the previous library and setup the connection to work with AstraDB cloud-based service. You work with the class AstraClient (that configure StargateClient for you). As you can see on the figure below the AstraClient handles not only Stargate Apis but also Astra Devops Api and Apache Pulsar. To get started follow the Astra SDK quickstart guide.

  • The Astra Spring Boot Starter: Imported in a Spring Boot application, it configures both Astra SDK and Spring Data Cassandra to work with AstraDB. Configuration is read in application.yaml. The starter will initialize any beans you would need (AstraClient, CqlSession, StargateClient. To get started follow the Astra Spring Boot Starter QuickStart guide.

What's NEXT ?

  1. QuickStart for Stargate
  2. QuickStart for Astra
  3. QuickStart for Astra Spring Boot Starter

Release Workflow

Prerequisites

  • Start the ssh-agent
eval "$(ssh-agent -s)"
  • Add the ssh key to the agent
cd ~/.ssh
ssh-add githubff4j
  • cleanup sources
find . -type f -name *.DS_Store -ls -delete
git pull
git add -A
git commit -m "delivery"
git push

Release

  • Run release
mvn release:prepare release:perform
  • Go to the taglist on github then create the release

  • Create a release note document

`Fixes:`
 + XXX (#000)
`Evolutions`
 + YYY (#000)

astra-sdk-java's People

Contributors

aar0np avatar bytestreme avatar clun avatar dependabot[bot] avatar djsauble avatar eolivelli avatar kidrecursive avatar msmygit avatar snyk-bot avatar tatu-at-datastax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

astra-sdk-java's Issues

Implements failover between Astra Regions for All Endpoints (Circuit Breaker)

On 9/14 the multi region support has been introduced to Astra. On each region (datacenters) you will have:

  • A dedicated REST Endpoint
  • A dedicated graphQL endpoint
  • A dedicated secure connect bundle

As a consequence the drivers cannot failover on their own, they need the secure bundle. The fail-over has to be handle at the SDK level.

AstraClient client = AstraClient.builder()
 .databaseId("astra_cluster_id")  
 .databaseRegion("eu-central-1")
 .databaseFallbackRegions("us-east-1", "us-east-2")
 .keyspace("ks1")
 .token("AstraCS:......") 
 .clientId("TWRvjlcrgfZYfhcxGZhUlAAA") 
 .clientSecret("7xKSrZPLbWxDJ0WXyj..") 
 .build();

We could try add settings on the retry mechanism:

astra.retries.count: 3
astra.retries.healthcheckPeriod: 1min 

Change default connection.pool.local.size

Hi Team,
Astra is using DSE which is based on TPC, a lower value of the local connection pool will cause more issues that benefit, can we bump this value to a higher say 8, and add it clearly in documentation to configure it correctly?

    { "name": "astra.cql.driver-config.advanced.connection.pool.local.size",
      "type": "java.lang.Integer",
      "description":"The number of connections in the pool.",
      "defaultValue": "1" },

Allow to work with raw Json payload for document API

The current implementation expects the developers to provide BEAN to be populated.

As the unmarshalling / deserialization could be customize allow to work with Raw Json or provide options to implement external mapper.

Cope with Hibernated Databases

On the free tier, after 23H , Astra will put the database instance in hibernation state.

From there any call will wake up the database. The first call will return 503 coding for a Service not (yet) available. This make the SDK initialization failing.

Enhancement: At initialization, if the code return is 503 corresponding to an hibernated state (need to be confirmed with explict message, the SDK will log it and wait and retry until the DB is available to keep initializing.

Implements Load Balancing in Stargate nodes of same DC

When running into Kubernetes Stargate will have its own service doing the load balancing for us.
When running in Astra, a load balancer is already in place.

When running Stargate on your own Cassandra installation you may leverage on a DNS load balancer or use the client side load balancing here.

  • Add a way to setup multiple nodes and split per DC.
StargateClient sc = StargateClient.builder()
                // CQL 
                .withAuthCredentials("cassandra","cassandra")
                .withLocalDatacenter("datacenter1")
                .withContactPoints("127.0.0.1:9045")
                .withKeyspace("ks1")
                // API
                .withApiNode(new StargateNode("localhost"))
                .withApiNode(new StargateNode("127.0.0.1"))
                .withApiNodeDC("datacenter1", 
                        new StargateNode("node11",  "http://localhost:8082",  "http://localhost:8080",  "http://localhost:8081"))
                .build()) {
  • Implement Load balancing

Implement an observer system

Idea:
Register your listener on get notify for each call (audit, monitoring)

  • Provide the listener system
  • Provide a AuditLogListener
  • Provide a PrometheusListener
  • Provide a Grafana Dashboard

Build failure on some systems due to transitive `grpc-core`/`grpc-api` dependency

On some systems (but not all; seems to depend on Maven repository configuration locally), build fails with:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.278 s
[INFO] Finished at: 2022-09-28T10:17:38-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project stargate-sdk: Could not resolve dependencies for project com.datastax.stargate:stargate-sdk:jar:0.3.5-SNAPSHOT: Failed to collect dependencies at io.grpc:grpc-netty-shaded:jar:1.49.1 -> io.grpc:grpc-core:jar:[1.49.1]: No versions available for io.grpc:grpc-core:jar:[1.49.1] within specified range -> [Help 1]
[ERROR] 

which is somehow triggered by (rare) use of version-range dependency in grpc-netty-shaded:

https://mvnrepository.com/artifact/io.grpc/grpc-netty-shaded/1.49.1

This can be worked around by forcing dependencies at main level.
I will provide a PR for that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.