Skip to content

mveeprojects/ScalaCassandra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScalaCassandra

Simple Scala app to learn about Cassandra integration.

Running the app

SBT docker compose plugin

To run the application and Cassandra together via docker-compose, from the root of the project run the following ./sbt dockerComposeUp.

Cassandra in docker, app in IntelliJ

  1. Run this from the root of the project ./docker/CassandraVanillaDocker.sh, wait a few seconds (up to 10/20) for Cassandra to become ready.
  2. Start the app up in IntelliJ.

Running all tests via docker

The following sbt command will start the required docker containers, run the tests (with a readiness check waiting for the app to become ready), and then stop and remove all containers.

./sbt runAllTests

HTTP Endpoints

Return all videos for a user

curl localhost:8080/videos/<userId>

Return first N number of videos from a users' list

curl localhost:8080/videos/<userId>/<n>

Add an item to a users' videos

curl -X PUT localhost:8080/videos/<userId>/<videoId>

Remove an item from a users' videos

curl -X DELETE localhost:8080/videos/<userId>/<videoId>

Metrics

Metrics surfaced by Kamon are exposed here -> http://localhost:9095/metrics

Custom Metrics

cassandra_reachable

  • value of 1 represents "true", cassandra is reachable, this is the default value on startup
  • code to be added to set this to 0 ("false") in the event cassandra is unreachable

Cqlsh

To access the command line (cqlsh) via docker

docker exec -it cassandra_container_name_or_id cqlsh

To view all keyspaces

describe keyspaces

To switch keyspace

use keyspace_name;

To list all tables

describe tables;

To select all records from a table

select * from table_name;

Sources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published