{"id":24617657,"url":"https://github.com/pacphi/reactive-cassy","last_synced_at":"2026-04-14T04:02:45.560Z","repository":{"id":48529962,"uuid":"118001974","full_name":"pacphi/reactive-cassy","owner":"pacphi","description":"Sample Spring Boot + Spring Data Cassandra project","archived":false,"fork":false,"pushed_at":"2021-07-21T13:22:04.000Z","size":291,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T23:39:40.092Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pacphi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-18T15:37:35.000Z","updated_at":"2019-01-03T15:49:16.000Z","dependencies_parsed_at":"2022-08-31T12:12:58.476Z","dependency_job_id":null,"html_url":"https://github.com/pacphi/reactive-cassy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacphi%2Freactive-cassy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacphi%2Freactive-cassy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacphi%2Freactive-cassy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacphi%2Freactive-cassy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pacphi","download_url":"https://codeload.github.com/pacphi/reactive-cassy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244308666,"owners_count":20432248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-24T23:39:48.965Z","updated_at":"2026-04-14T04:02:40.527Z","avatar_url":"https://github.com/pacphi.png","language":"Java","readme":"# Reactive Cassandra Example\n\n[![Build Status](https://travis-ci.org/pacphi/reactive-cassy.svg)](https://travis-ci.org/pacphi/reactive-cassy) [![Known Vulnerabilities](https://snyk.io/test/github/pacphi/reactive-cassy/badge.svg)](https://snyk.io/test/github/pacphi/reactive-cassy)\n\nThis project explores the [Reactive Cassandra Support](https://docs.spring.io/spring-data/cassandra/docs/2.1.0.RELEASE/reference/html/#cassandra.reactive) in [Spring Data Cassandra](https://spring.io/projects/spring-data-cassandra), specifically: how to implement a [reactive repository](https://docs.spring.io/spring-data/cassandra/docs/2.1.0.RELEASE/reference/html/#cassandra.reactive.repositories), author integration tests, configuring the app to run locally against a [Docker image](https://hub.docker.com/r/bitnami/cassandra/) of Cassandra, and deploying the app to [Pivotal Application Service](https://pivotal.io/platform/pivotal-application-service) interacting with an Azure CosmosDB instance via the [Cassandra API](https://docs.microsoft.com/en-us/azure/cosmos-db/cassandra-introduction).\n\n\n## Prerequisites\n\n* An account with [Space Developer role](https://docs.cloudfoundry.org/concepts/roles.html#roles) access on a Cloud Foundry foundation, e.g., [Pivotal Web Services](https://run.pivotal.io)\n* An [account](https://azure.microsoft.com/free/) on Microsoft [Azure](https://azure.microsoft.com/)\n* [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) 2.0.46 or better\n* [CF CLI](https://github.com/cloudfoundry/cli#downloads) 6.40.0 or better if you want to push the application to a Cloud Foundry (CF) instance\n* [httpie](https://httpie.org/#installation) 1.0.2 or better to simplify interaction with API endpoints\n* [jq](https://stedolan.github.io/jq/) 1.6 or better\n* Java [JDK](https://openjdk.java.net/install/) 1.8u192 or better to compile and run the code\n* [Gradle](https://gradle.org/releases/) 4.10.3 or better to build and package source code\n* Docker for [Mac](https://store.docker.com/editions/community/docker-ce-desktop-mac) or [Windows](https://store.docker.com/editions/community/docker-ce-desktop-windows) for spinning up a local instance of Cassandra and [cassandra-web](https://hub.docker.com/r/metavige/cassandra-web/) (an administration interface)\n* [cqlsh](http://cassandra.apache.org/doc/4.0/tools/cqlsh.html) the CQL shell \n\t* on a Mac it's easy to install w/ [Homebrew](https://brew.sh) using `brew install cassandra`\n\n\n## Clone\n\n```\ngit clone https://github.com/pacphi/reactive-cassy.git\n```\n\n\n## Build\n\nBuild this project with Gradle\n\n\n```\ngradle clean build\n```\n\nIf you're on a Mac you will want to execute the following (once) \n\n```bash\n./install.sigar.macos.sh\n```\n\nand then\n\n```\ngradle clean build -Djava.library.path=$JAVA_LIBRARY_PATH:~/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:. -Ddebug\n```\n\n## Prepare\n\nTo run the project, need to run below `cql` commands on Cassandra.\n\n### Connect to a Cassandra instance\n\nWe'll explore two options\n\n#### Docker hosted\n\nStart the server\n\n```\ndocker run -d --name cassandra-server \\\n    --network app-tier \\\n    bitnami/cassandra:latest\n```\n\nConnect via cqlsh\n\n```\ndocker run -it --rm \\\n    --network app-tier \\\n    bitnami/cassandra:latest cqlsh --username cassandra --password cassandra cassandra-server\n```\n\nIf you want to access the server from the host machine where you have `cqlsh` already installed, you could start it with \n\n```\ndocker run -d -p 9042:9042 -e CASSANDRA_HOST=127.0.0.1 \\\n    --name cassandra-server \\\n    --network app-tier \\\n    bitnami/cassandra:latest\n```\n\nthen\n\n```\ncqlsh -u cassandra -p cassandra\n```\n\n#### Azure hosted CosmosDB\n\nFire up a browser and [login](http://portal.azure.com) to the Azure portal\n\nAlso launch a [Terminal](https://macpaw.com/how-to/use-terminal-on-mac) session, set your subscription account and create a new resource group, e.g.,\n\n```\naz login\naz account set --subscription 90c2a5c6-0aef-963d-b153-f44d21402d98\naz group create --name spring-data-experiments --location westus\n```\n\n\u003e Replace values for `--subscription`, `--name`, and `--location` above with your own.\n\nVisit the Azure portal in your browser, navigate to `Azure Cosmos DB`, and add a new instance\n\n![Image from Azure portal illustrating how to create a new Cosmos DB instance](docs/new-cosmos-db-cassandra-instance.png)\n\nVisit your new instance's `Settings \u003e Connection String` and make a note of the: `contact point`, `port`, `username` and `primary password`.\n\nThen connect (on a Mac) with, e.g.,\n\n```\nexport SSL_VERSION=TLSv1_2 \nexport SSL_VALIDATE=false \ncqlsh cassy.cassandra.cosmosdb.azure.com 10350 -u cassy -p XJuTjJZLHaAVcAqrVYH4aVu6lhfDk9vOMJ9ePHosv3p4Tpa19N0ZBydmpDtBwpnaaMQeGLzBvKCD7ObEjGXgTU== --ssl\n```\n\n\u003e Replace the last line above with your own instance's connection details, like `cqlsh {contact point} {port} -u {username} -p {primary password} --ssl`\n\n\n### Keyspace Creation\n\nOnce connected we need to create a keyspace\n\n```bash\nCREATE KEYSPACE IF NOT EXISTS customers WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3' };\n```\n\n### Table Creation\n\nLet's create a table and indexes\n\n```\nUSE customers;\nCREATE TABLE customer (id TimeUUID PRIMARY KEY, firstname text, lastname text);\nCREATE INDEX customerfirstnameindex ON customer (firstname);\nCREATE INDEX customerlastnameindex ON customer (lastname);\n```\n\n\u003e As of 2018-10-13 Azure Cosmos DB does not yet support `CREATE INDEX`; therefore, skip executing the last two lines above when connected to a Cosmos DB instance\n\n\n## Run \n\nTo startup the application, execute\n\n### Simple case \n\nWe'll fire up a local Docker instance of Cassandra, execute the [Keyspace](#keyspace-creation) and [Table](#table-creation) creation steps above, then start the application \n\n```bash\ndocker run -d -p 9042:9042 -e CASSANDRA_HOST=127.0.0.1 \\\n    --name cassandra-server \\\n    --network app-tier \\\n    bitnami/cassandra:latest\ngradle bootRun -Dspring.profiles.active=docker\n```\n\n### with Docker Compose\n\n// TODO\n\n### with Kubernetes\n\n// TODO\n\n\n## How to deploy to Pivotal Application Service\n\nThese instructions assume that a Cassandra instance is available and was pre-provisioned \"off-platform\" (e.g., on PKS or Azure Cosmos DB).\n\n### Authenticating\n\nAuthenticate to a foundation using the API endpoint. \n\u003e E.g., login to [Pivotal Web Services](https://run.pivotal.io)\n\n```\ncf login -a https:// api.run.pivotal.io\n```\n\n### Managing secrets\n\nPlace secrets in `config/secrets.json`, e.g.,\n\n```\n{\n\t\"CONTACT_POINT\" : \"xxxxx\",\n\t\"PORT\" : xxxxx,\n\t\"USERNAME\" : \"xxxxx\",\n\t\"PASSWORD\" : \"xxxxx\"\n}\n```\n\nWe'll use this file later as input configuration for the creation of either a [credhub](https://docs.pivotal.io/credhub-service-broker/using.html) or [user-provided](https://docs.cloudfoundry.org/devguide/services/user-provided.html#credentials) service instance.\n\n\u003e Replace occurrences of `xxxxx` above with appropriate values\n\n### Deploy and shutdown\n\nDeploy the app (w/ a user-provided service instance vending secrets)\n\n```\n./deploy.sh\n```\n\nDeploy the app (w/ a Credhub service instance vending secrets)\n\n```\n./deploy.sh --with-credhub\n```\n\nShutdown and destroy the app and service instances\n\n```\n./destroy.sh\n```\n\n\n## Endpoints\n\nCurrent implementation supports\n\n### POST /customers\n\n```\nhttp POST {host}:{port}/customers firstName=Nick lastName=Fury\n```\n\n### PUT /customers/{id}\n\n```\nhttp PUT {host}:{port}/customers/f91116f0-cf20-11e8-b999-7fb395277057 firstName=Nick lastName=Gone\n```\n\n### GET /customers/{id}\n\n```\nhttp {host}:{port}/customers/f91116f0-cf20-11e8-b999-7fb395277057\n```\n\n### GET /customers?lastName={lastName}\u0026firstName={firstName}\n\n```\nhttp {host}:{port}/customers?lastName=Gone\nhttp {host}:{port}/customers?firstName=Nick\nhttp {host}:{port}/customers?lastName=Gone\u0026firstName=Nick\n```\n\n### GET /stream/customers\n\n```\nhttp {host}:{port}/stream/customers\n```\n\n### DELETE /customers/{id}\n\n```\nhttp DELETE {host}:{port}/customers/f91116f0-cf20-11e8-b999-7fb395277057\n```\n\n\n## Credits and further reading\n\nTo those who've blazed trails...\n\n* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)\n* [Spring Data for Cassandra - Reference Documentation](https://docs.spring.io/spring-data/cassandra/docs/2.0.5.RELEASE/reference/html/)\n* [Cassandra with Java](https://www.baeldung.com/cassandra-with-java)\n* [Cannot execute this query as it might involve data filtering](https://medium.com/@sameira/spring-data-cassandra-cannot-execute-this-query-as-it-might-involve-data-filtering-377cb5afda68)\n* [Reactive Streams with Spring Data Cassandra](https://dzone.com/articles/reactive-streams-with-spring-data-cassandra)\n* [Spring Data Cassandra 2.0 - Reactive examples](https://github.com/spring-projects/spring-data-examples/tree/master/cassandra/reactive)\n* [Spring HATEOAS - API Evolution Example](https://github.com/spring-projects/spring-hateoas-examples/tree/master/api-evolution)\n* [Introduction to the Azure Cosmos DB Cassandra API](https://docs.microsoft.com/en-us/azure/cosmos-db/cassandra-introduction)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacphi%2Freactive-cassy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpacphi%2Freactive-cassy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacphi%2Freactive-cassy/lists"}