Illustration Image

Cassandra.Link

The best knowledge base on Apache Cassandra®

Helping platform leaders, architects, engineers, and operators build scalable real time data platforms.

9/23/2020

Reading time:7 min

Seattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra

by Josh Turner

Seattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra SlideShare Explore You Successfully reported this slideshow.Seattle Cassandra Users: An OSS Java Abstraction Layer for CassandraUpcoming SlideShareLoading in …5× 1 Comment 0 Likes Statistics Notes Be the first to like this No DownloadsNo notes for slide03/05/2018 – 1.0 Internal Release 04/05/2018 – 1.1 Release Highlights: ASync calls and Solr support added 06/22/2018 – 1.2 Release Open Sourced! Highlights: Added Spring Config, open source optimizations 09/17/2018 – 1.3 Release Highlights: Added SSL, Updated Driver, Optional DSE Licensed Driver, Solr Search By Object (Req 6.0+) 05/01/2018 – 1.4 Release Highlights: Generate CLI, Enhanced Filter policies curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"payload": {"keyOne": 1,"keyTwo": 1}}' 'http://localhost:8080/daodemo/v1/myapp/table_name/exists' -v POST /daodemo/v1/myapp/table_name/exists HTTP/1.1 Host: localhost:8080 User-Agent: curl/7.54.0 Content-Type: application/json Accept: application/json Content-Length: 38 { "payload": { "keyOne": 1, "keyTwo": 1 } } HTTP/1.1 200 Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked Date: Tue, 04 Jun 2019 16:19:41 GMT { "status":"SUCCCES", "payloadClass":"class java.lang.Boolean", "payload":[false], "timestamp":1559665181509 }curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"payload": {"keyOne": 1,"keyTwo": 1,"colOne":"column one", "colTwo":"column two"}}' 'http://localhost:8080/daodemo/v1/myapp/table_name/save' -v POST /daodemo/v1/myapp/table_name/save HTTP/1.1 Host: localhost:8080 User-Agent: curl/7.54.0 Content-Type: application/json Accept: application/json Content-Length: 83 { "payload": { "keyOne": 1, "keyTwo": 1, "colOne":"column two", "colTwo":"column 2" } } HTTP/1.1 200 Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked Date: Tue, 04 Jun 2019 16:22:30 GMT { "status":"SUCCCES", "payloadClass":null, "payload":null, "timestamp":1559665350588 } POST /daodemo/v1/myapp/table_name/get HTTP/1.1 Host: localhost:8080 User-Agent: curl/7.54.0 Content-Type: application/json Accept: application/json Content-Length: 38 { "payload": { "keyOne": 1, "keyTwo": 1 } } HTTP/1.1 200 Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked Date: Tue, 04 Jun 2019 16:26:09 GMT { "status":"SUCCCES", "payloadClass":"class com.demo.myapp.TableName", "payload":[ { "colOne":"column one", "colTwo":"column 2", "keyOne":1, "keyTwo":1 } ], "timestamp":1559665569202 } 1. CasquatchJosh Turner, June 26th, 2019Public 2. 2Who?Public 3. 3Public Josh Turner Principal Engineer @ T-Mobile Distributed Data SystemsLead Software DevelopmentEngineering/turnerjosh /tdl-jturnerWho am I & Where do I come from? 4. 4Why?Public 5. 55 Moving from Oracle™ to Cassandra High Learning Curve Complex Configuration Duplicated Code Missing Enterprise Best PracticesWhy build it?Public 6. 66 Versatile Framework Reduces Learning Curve Success Internally In T-Mobile Because We Can. #UnCarrierWhy share it?Public 7. 77 Cassandra Is A Name! Researched Nicknames Sasquatch Is Our Local Legend Casquatch Is Born!Why Casquatch?Public 8. 8What?Public 9. 9 Distributed, wide column store,NoSQL Database Masterless Architecture Tunable Consistency / AP Design Query Language : CQLWhat is Cassandra?Public 10. 10 Cassandra Made Easy! Java Abstraction Layer For Cassandra Pre-tuned For Enterprise BestPractices Object Oriented Code Generation Simple Object Based API Java Spring Boot FrameworkIntegrationWhat is Casquatch?Public 11. 11 Load Balancing / Geo Redundancy Connection Pooling Reconnection & Retry Policy Data Caching Workload Filtering SecurityWhat do I get?Public 12. 12ArchitectureJava ApplicationDSEDriverCassandraCasquatchPOJOsDSEObjectMapperPublic 13. 13 Open Source Only Model T-Mobile Open Source Group https://opensource.t-mobile.com Project Casquatch https://github.com/tmobile/casquatch JavaDocs https://tmobile.github.io/casquatch/Open SourcePublic 14. 14 We recognize that there is a wide range ofplatforms, and T-Mobile can't address themall. This is why we open sourcedCasquatch -- we hope the community willbe able to expand how Casquatch isused. As with any tool, consult with your ITdepartment before using in production. All code samples included are fordemonstration purposes only. Licensed under Apache 2.0 https://www.apache.org/licenses/LICENSE-2.0Open SourcePublic 15. 15 03/05/2018 – 1.0 Internal Release 04/05/2018 – 1.1 Release 06/22/2018 – 1.2 Release OpenSourced! 09/17/2018 – 1.3 Release 05/01/2019 – 1.4 ReleaseProject HistoryPublic 16. 16How?Public 17. 1717 We started with Spring Data All the testing went great… Untilproduction We didn’t know what we didn’tknow… Tried to fix Spring Decided to build and integrateHow did I get here?Public 18. 1818 Spring Data No High Availability No Retry Non Industry Best Practices Casquatch Highly Available Automatic Retry Follows Industry Best Practices Savings Significant reduction in support and design cost Highly Reliable ArchitectureHow does it compare?Public 19. 1919 Spring Data - Developer Effort ~150 Lines For Basic Configuration ~100 Lines Per Table ~10 Tables Per App Casquatch - Developer Effort ~10 lines of code Savings 1100+ lines of code and days of developertime for each applicationHow muchdo I have to write?Public 20. 2020 Command Line Interface Driven by Table Metadata Annotated Objects CustomizableCode GeneratorPublic 21. 2121 Hosted by Sonatype Available in Maven Central Include in pom.xmlMavenPublic 22. 2222 Optional Spring Boot Integration Add Import to Application.java Dependency InjectionSpring Boot IntegrationPublic 23. 2323 Skip Spring Boot Builder Pattern CassandraDriver.builder().withUsername() … .build() All properties are availableIf You BuildIt…Public 24. 24SHOW ME!Public 25. 25Public Standardapplication.properties The Basics Credentials, Contact Points,Keyspace, etc The Advanced Connection Limits, LoadBalancing,Timeout, SSL, etc Many More in README.mdSpring Boot Configuration:Code For Demonstration Purposes Only 26. 26Public Skip Spring Boot and Do It Yourself The Basics Credentials, Contact Points,Keyspace, etc The Advanced Connection Limits, LoadBalancing,Timeout, SSL, etc Many More in API DocsBuilder Pattern:Code For Demonstration Purposes Only 27. 27Public Create a Cassandra Table Columns use _ for spaces Supports all data types Supports UDTCreate Schema:Code For Demonstration Purposes Only 28. 28Public Run the code generator Read in settings on command lineor from properties file Configurable options More in README.mdCreate Some Code:Code For Demonstration Purposes Only 29. 29Public Custom Package Only Required ImportsGet Some Code: tableName.javaCode For Demonstration Purposes Only 30. 30Public Comments Full CQL AnnotatedGet Some Code: tableName.javaCode For Demonstration Purposes Only 31. 31Public JavaDoc Constructors Getters and SettersGet Some Code: tableName.javaCode For Demonstration Purposes Only 32. 32Public Package option creates pom.xml Snippet shorted for slide Complete ArtifactGet Some Code: pom.xmlCode For Demonstration Purposes Only 33. 33Public T getById(Class<T> c, T o) : Get by passing an object instance with the keypopulated. void save(Class<T> c, T o) : Save by passing an object instance. void delete(Class<T> c, T o): Delete by passing an object instance with the keypopulatedUse The Code:Code For Demonstration Purposes Only 34. 34Sneak Peak!The Following FunctionalityIs Not FinalPublic 35. 35Public Run the code generator with a –dao Generate the Data Access Object REST APIs Deployable Microservice Unit Tested with MockitoGenerate a DAOCode For Demonstration Purposes Only 36. 36Public Swagger UI Integration Basic Casquatch APIs exposed Wrapped in Request/Responsepayload objects Simple JSON interface Clean error messaging and statuscodesDAO - SwaggerCode For Demonstration Purposes Only 37. 3737 PublicDAO - ExistsCode For Demonstration Purposes Only 38. 3838 PublicDAO - SaveCode For Demonstration Purposes Only 39. 3939 PublicDAO - GetCode For Demonstration Purposes Only 40. 40Public Utilizes genericAbstractCassandraDAO Easily extensible Adjust URL through annotationDAO - ImplementationCode For Demonstration Purposes Only 41. 41Public Thin wrapper Consistent Request/Responseobjects Functionality Mirrors CasquatchAPIDAO - ImplementationCode For Demonstration Purposes Only 42. ClosingSlidesLET’STALK 43. ClosingSlides Recommended Cassandra @ T-MobileJosh Turner Project Casquatch: An Open Source Java Abstraction Framework for Cassandra Da...Josh Turner One Click Provisioning With Enterprise Manager 12cJosh Turner What to Upload to SlideShareSlideShare Customer Code: Creating a Company Customers LoveHubSpot Be A Great Product Leader (Amplify, Oct 2019)Adam Nash Trillion Dollar Coach Book (Bill Campbell)Eric Schmidt About Blog Terms Privacy Copyright × Public clipboards featuring this slideNo public clipboards found for this slideSelect another clipboard ×Looks like you’ve clipped this slide to already.Create a clipboardYou just clipped your first slide! Clipping is a handy way to collect important slides you want to go back to later. Now customize the name of a clipboard to store your clips. Description Visibility Others can see my Clipboard

Illustration Image
Seattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra

Successfully reported this slideshow.

Seattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra
Casquatch
Josh Turner, June 26th, 2019
Public
2
Who?
Public
3Public
 Josh Turner
 Principal Engineer @ T-Mobile
 Distributed Data Systems
Lead
 Software Development
Engineering
/...
4
Why?
Public
55
 Moving from Oracle™ to Cassandra
 High Learning Curve
 Complex Configuration
 Duplicated Code
 Missing Enterprise...
66
 Versatile Framework
 Reduces Learning Curve
 Success Internally In T-Mobile
 Because We Can. #UnCarrier
Why share ...
77
 Cassandra Is A Name!
 Researched Nicknames
 Sasquatch Is Our Local Legend
 Casquatch Is Born!
Why Casquatch?
Public
8
What?
Public
9
 Distributed, wide column store,
NoSQL Database
 Masterless Architecture
 Tunable Consistency / AP Design
 Query Lan...
10
 Cassandra Made Easy!
 Java Abstraction Layer For Cassandra
 Pre-tuned For Enterprise Best
Practices
 Object Orient...
11
 Load Balancing / Geo Redundancy
 Connection Pooling
 Reconnection & Retry Policy
 Data Caching
 Workload Filterin...
12
Architecture
Java Application
DSE
Drive
r
Cassandra
Casquatch
POJ
Os
DSE
Object
Mapper
Public
13
 Open Source Only Model
 T-Mobile Open Source Group
 https://opensource.t-mobile.com
 Project Casquatch
 https://g...
14
 We recognize that there is a wide range of
platforms, and T-Mobile can't address them
all. This is why we open source...
15
 03/05/2018 – 1.0 Internal Release
 04/05/2018 – 1.1 Release
 06/22/2018 – 1.2 Release Open
Sourced!
 09/17/2018 – ...
16
How?
Public
1717
 We started with Spring Data
 All the testing went great… Until
production
 We didn’t know what we didn’t
know…
 ...
1818
 Spring Data
 No High Availability
 No Retry
 Non Industry Best Practices
 Casquatch
 Highly Available
 Automa...
1919
 Spring Data - Developer Effort
 ~150 Lines For Basic Configuration
 ~100 Lines Per Table
 ~10 Tables Per App
 C...
2020
 Command Line Interface
 Driven by Table Metadata
 Annotated Objects
 Customizable
Code Generator
Public
2121
 Hosted by Sonatype
 Available in Maven Central
 Include in pom.xml
Maven
Public
2222
 Optional Spring Boot Integration
 Add Import to Application.java
 Dependency Injection
Spring Boot Integration
Pu...
2323
 Skip Spring Boot
 Builder Pattern
 CassandraDriver.builder().withUsern
ame() … .build()
 All properties are avai...
24
SHOW ME!
Public
25Public
 Standard
application.properties
 The Basics
 Credentials, Contact Points,
Keyspace, etc
 The Advanced
 Conn...
26Public
 Skip Spring Boot and Do It Yourself
 The Basics
 Credentials, Contact Points,
Keyspace, etc
 The Advanced
 ...
27Public
 Create a Cassandra Table
 Columns use _ for spaces
 Supports all data types
 Supports UDT
Create Schema:
Cod...
28Public
 Run the code generator
 Read in settings on command line
or from properties file
 Configurable options
 More...
29Public
 Custom Package
 Only Required Imports
Get Some Code: tableName.java
Code For Demonstration Purposes Only
30Public
 Comments
 Full CQL
 Annotated
Get Some Code: tableName.java
Code For Demonstration Purposes Only
31Public
 JavaDoc
 Constructors
 Getters and Setters
Get Some Code: tableName.java
Code For Demonstration Purposes Only
32Public
 Package option creates pom.xml
 Snippet shorted for slide
 Complete Artifact
Get Some Code: pom.xml
Code For ...
33Public
 T getById(Class<T> c, T o) : Get by passing an object instance with the key
populated.
 void save(Class<T> c, ...
34
Sneak Peak!
The Following FunctionalityIs Not Final
Public
35Public
 Run the code generator with a –
dao
 Generate the Data Access Object
 REST APIs
 Deployable Microservice
 U...
36Public
 Swagger UI Integration
 Basic Casquatch APIs exposed
 Wrapped in Request/Response
payload objects
 Simple JS...
3737 Public
DAO - Exists
Code For Demonstration Purposes Only
3838 Public
DAO - Save
Code For Demonstration Purposes Only
3939 Public
DAO - Get
Code For Demonstration Purposes Only
40Public
 Utilizes generic
AbstractCassandraDAO
 Easily extensible
 Adjust URL through annotation
DAO - Implementation
...
41Public
 Thin wrapper
 Consistent Request/Response
objects
 Functionality Mirrors Casquatch
API
DAO - Implementation
C...
ClosingSlides
LET’S
TALK
ClosingSlides

Upcoming SlideShare

Loading in …5

×

  • Be the first to like this

  1. 1. Casquatch Josh Turner, June 26th, 2019 Public
  2. 2. 2 Who? Public
  3. 3. 3Public  Josh Turner  Principal Engineer @ T-Mobile  Distributed Data Systems Lead  Software Development Engineering /turnerjosh /tdl-jturner Who am I & Where do I come from?
  4. 4. 4 Why? Public
  5. 5. 55  Moving from Oracle™ to Cassandra  High Learning Curve  Complex Configuration  Duplicated Code  Missing Enterprise Best Practices Why build it? Public
  6. 6. 66  Versatile Framework  Reduces Learning Curve  Success Internally In T-Mobile  Because We Can. #UnCarrier Why share it? Public
  7. 7. 77  Cassandra Is A Name!  Researched Nicknames  Sasquatch Is Our Local Legend  Casquatch Is Born! Why Casquatch? Public
  8. 8. 8 What? Public
  9. 9. 9  Distributed, wide column store, NoSQL Database  Masterless Architecture  Tunable Consistency / AP Design  Query Language : CQL What is Cassandra? Public
  10. 10. 10  Cassandra Made Easy!  Java Abstraction Layer For Cassandra  Pre-tuned For Enterprise Best Practices  Object Oriented Code Generation  Simple Object Based API  Java Spring Boot Framework Integration What is Casquatch? Public
  11. 11. 11  Load Balancing / Geo Redundancy  Connection Pooling  Reconnection & Retry Policy  Data Caching  Workload Filtering  Security What do I get? Public
  12. 12. 12 Architecture Java Application DSE Drive r Cassandra Casquatch POJ Os DSE Object Mapper Public
  13. 13. 13  Open Source Only Model  T-Mobile Open Source Group  https://opensource.t-mobile.com  Project Casquatch  https://github.com/tmobile/casquatch  JavaDocs  https://tmobile.github.io/casquatch/ Open Source Public
  14. 14. 14  We recognize that there is a wide range of platforms, and T-Mobile can't address them all. This is why we open sourced Casquatch -- we hope the community will be able to expand how Casquatch is used. As with any tool, consult with your IT department before using in production.  All code samples included are for demonstration purposes only.  Licensed under Apache 2.0  https://www.apache.org/licenses/LICENSE-2.0 Open Source Public
  15. 15. 15  03/05/2018 – 1.0 Internal Release  04/05/2018 – 1.1 Release  06/22/2018 – 1.2 Release Open Sourced!  09/17/2018 – 1.3 Release  05/01/2019 – 1.4 Release Project History Public
  16. 16. 16 How? Public
  17. 17. 1717  We started with Spring Data  All the testing went great… Until production  We didn’t know what we didn’t know…  Tried to fix Spring  Decided to build and integrate How did I get here? Public
  18. 18. 1818  Spring Data  No High Availability  No Retry  Non Industry Best Practices  Casquatch  Highly Available  Automatic Retry  Follows Industry Best Practices  Savings  Significant reduction in support and design cost  Highly Reliable Architecture How does it compare? Public
  19. 19. 1919  Spring Data - Developer Effort  ~150 Lines For Basic Configuration  ~100 Lines Per Table  ~10 Tables Per App  Casquatch - Developer Effort  ~10 lines of code  Savings  1100+ lines of code and days of developer time for each application How muchdo I have to write? Public
  20. 20. 2020  Command Line Interface  Driven by Table Metadata  Annotated Objects  Customizable Code Generator Public
  21. 21. 2121  Hosted by Sonatype  Available in Maven Central  Include in pom.xml Maven Public
  22. 22. 2222  Optional Spring Boot Integration  Add Import to Application.java  Dependency Injection Spring Boot Integration Public
  23. 23. 2323  Skip Spring Boot  Builder Pattern  CassandraDriver.builder().withUsern ame() … .build()  All properties are available If You BuildIt… Public
  24. 24. 24 SHOW ME! Public
  25. 25. 25Public  Standard application.properties  The Basics  Credentials, Contact Points, Keyspace, etc  The Advanced  Connection Limits, LoadBalancing, Timeout, SSL, etc  Many More in README.md Spring Boot Configuration: Code For Demonstration Purposes Only
  26. 26. 26Public  Skip Spring Boot and Do It Yourself  The Basics  Credentials, Contact Points, Keyspace, etc  The Advanced  Connection Limits, LoadBalancing, Timeout, SSL, etc  Many More in API Docs Builder Pattern: Code For Demonstration Purposes Only
  27. 27. 27Public  Create a Cassandra Table  Columns use _ for spaces  Supports all data types  Supports UDT Create Schema: Code For Demonstration Purposes Only
  28. 28. 28Public  Run the code generator  Read in settings on command line or from properties file  Configurable options  More in README.md Create Some Code: Code For Demonstration Purposes Only
  29. 29. 29Public  Custom Package  Only Required Imports Get Some Code: tableName.java Code For Demonstration Purposes Only
  30. 30. 30Public  Comments  Full CQL  Annotated Get Some Code: tableName.java Code For Demonstration Purposes Only
  31. 31. 31Public  JavaDoc  Constructors  Getters and Setters Get Some Code: tableName.java Code For Demonstration Purposes Only
  32. 32. 32Public  Package option creates pom.xml  Snippet shorted for slide  Complete Artifact Get Some Code: pom.xml Code For Demonstration Purposes Only
  33. 33. 33Public  T getById(Class<T> c, T o) : Get by passing an object instance with the key populated.  void save(Class<T> c, T o) : Save by passing an object instance.  void delete(Class<T> c, T o): Delete by passing an object instance with the key populated Use The Code: Code For Demonstration Purposes Only
  34. 34. 34 Sneak Peak! The Following FunctionalityIs Not Final Public
  35. 35. 35Public  Run the code generator with a – dao  Generate the Data Access Object  REST APIs  Deployable Microservice  Unit Tested with Mockito Generate a DAO Code For Demonstration Purposes Only
  36. 36. 36Public  Swagger UI Integration  Basic Casquatch APIs exposed  Wrapped in Request/Response payload objects  Simple JSON interface  Clean error messaging and status codes DAO - Swagger Code For Demonstration Purposes Only
  37. 37. 3737 Public DAO - Exists Code For Demonstration Purposes Only
  38. 38. 3838 Public DAO - Save Code For Demonstration Purposes Only
  39. 39. 3939 Public DAO - Get Code For Demonstration Purposes Only
  40. 40. 40Public  Utilizes generic AbstractCassandraDAO  Easily extensible  Adjust URL through annotation DAO - Implementation Code For Demonstration Purposes Only
  41. 41. 41Public  Thin wrapper  Consistent Request/Response objects  Functionality Mirrors Casquatch API DAO - Implementation Code For Demonstration Purposes Only
  42. 42. ClosingSlides LET’S TALK
  43. 43. ClosingSlides

×

Related Articles

spring
rest
api

GitHub - DataStax-Examples/spring-data-starter: ⚡️ A sample Spring Data Cassandra REST API

John Doe

2/14/2024

cassandra
java

Checkout Planet Cassandra

Claim Your Free Planet Cassandra Contributor T-shirt!

Make your contribution and score a FREE Planet Cassandra Contributor T-Shirt! 
We value our incredible Cassandra community, and we want to express our gratitude by sending an exclusive Planet Cassandra Contributor T-Shirt you can wear with pride.

Join Our Newsletter!

Sign up below to receive email updates and see what's going on with our company

Explore Related Topics

AllKafkaSparkScyllaSStableKubernetesApiGithubGraphQl

Explore Further

cassandra