Spring – Cassandra – Firebrand ocm
As you probably know, NoSQL era has begun for several (good) reasons
– Can run on large clusters
– Are easy to integrate
– Are said to scale in a linear way.
– Addresses different
problematic solutions than classical RDBMS systems.
- Clone this project: https://github.com/jrevault/SpringFirebrandCassandra or download it (https://github.com/jrevault/SpringFirebrandCassandra/archive/master.zip)
- Download and run cassandra : http://cassandra.apache.org/download/
- Launch cassandra-cli and ‘create keyspace QUIDQUID;’ case is sensitive
- Call : ‘mvn jetty:run’ on the project command line
Play with URLs :
- http://localhost:8080/v1/users/ok (test if everything works, should return “OK”)
- http://localhost:8080/v1/users/hello?name=World! (test if everything works, should return “Hello, Wolrd!”)
- http://localhost:8080/v1/users/list (Lists all users inside Cassandra, should be empty)
- http://localhost:firstname.lastname@example.org&name=Toto&pwd=SeCrEt (Creates a user inside Cassandra)
- http://localhost:8080/v1/users/read?id=….. (Reads a specific users from Cassandra)
- http://localhost:8080/v1/users/delete?id=….. (Deletes a specific users from Cassandra)
Whats behind the hood ?
Check the pom.xml for dependencies, and look inside the WEB-INF/applicationContext.xml for Firebrand ocm configutration.
Just go through code from the UserController to the UserDao (yes it’s empty) that extends a simple GenericDao for basic CRUD(LE) operations (LE stands dor LIST and EXISTS).
As you can see it is damn fast to work on this kind of environement.