pivotal-cf/cf-cassandra-spring-example-app

Name: cf-cassandra-spring-example-app

Owner: Pivotal Cloud Foundry

Description: null

Created: 2015-12-09 17:57:41.0

Updated: 2018-04-05 11:52:27.0

Pushed: 2016-01-11 11:45:14.0

Homepage: null

Size: 43

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Example Cassandra Application

This simple application illustrates the use of the Pivotal Cassandra data service in a Java Spring application running on Pivotal Cloud Foundry.

Installation
Running locally

To run the application locally, you need first to create a keyspace in your cassandra.

qlsh
ected to Test Cluster at 127.0.0.1:9042.
sh 5.0.1 | Cassandra 2.2.3 | CQL spec 3.3.1 | Native protocol v4]
HELP for help.

h> CREATE KEYSPACE example WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

The default keyspace name is example. You can change it in the application.properties file.

Running on Cloud Foundry
Create a Cassandra service instance

Find your Cassandra service via cf marketplace.

 marketplace
ing services from marketplace in org testing / space testing as me...


ice       plans          description
ssandra   multi-tenant   Cassandra service powered by DataStax Enterprise

Our service is called p-cassandra. To create an instance of this service, use:

 create-service p-cassandra multi-tenant cf-cassandra-example-service
Push the Example Application

First, you need to build the app. Ensure that you have got JDK v8 installed and your JAVA_HOME path correctly set.

On OSX you can set your JAVA_HOME path as follows

port JAVA_HOME=`/usr/libexec/java_home`
ho $JAVA_HOME
rary/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
ash
 install gradle
le assemble

The example application comes with a Cloud Foundry manifest.yml file, which provides all of the defaults necessary for an easy cf push.

To push the application, just run:

 push
Usage

You can now read, write and delete “users” by GETting, POSTing and DELETEing to /users.

rl -X GET  http://cassandra-example-app.example.com/users
rl -H "Content-Type: application/json" -X POST -d '{"username":"foobar", "fname": "foo", "lname": "bar"}' http://cassandra-example-app.example.com/users

Be sure to replace example.com with the actual domain of your Pivotal Cloud Foundry installation.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.