Quick start with a single node Cassandra on Mac as an example, emphasizing on the Java backend
To run on a stand-alone local node, if you're using Mac and haven't installed Cassandra:
- brew install cassandra
- brew services start cassandra
- brew info cassandra
After Cassandra has been installed, you will need to prepare the database schema. You can simply go to resource/schema directory and run:
- cqlsh -u cassandra -p cassandra -f user_activity.cql
You may want to use intellij to inspect this repo. The Maven pom.xml file has been well written. You can find the dependencies in that file. It should not be hard to figure out how to run/debug it.
If you want to deploy it, you can build it as a war file and deploy it on Tomcat.
It's using a MVC pattern.
You can find the views(JSPs) in the src/main/webapp/WEB-INF/view directory.
The controller is applying the similar pattern in this repo.
Interesting things happen in the model part. It's using singleton pattern for CassandraConnector and its DAOs. Callback style DB query is applied to CqlRequest. Besides, the CqlRequestFactory is using factory pattern to generate different kinds of CRUD requests. To make it more adaptable and avoid duplication code, classes are designed with layers. GenericDAO is the root class, supposed to handle basic CRUD methods only. Table specific DAOs can extend it and make more complex and specific queries. Data are encapsulated as beans. Java reflection is intensively used in the beans to achieve ORM-like queries.
- Existing activity logs
- Add a new log
- Delete a previous log
- Discuss about the compaction strategy
- Consider more about the consistency level
- Implement stream query features
- Make a blog
- Consider if Action pattern, synchronizing on a hashMap, will lead to performance issue
- How to achieve atomicity across difference tables, currently it's hard to achieve because different daos are used in controller layer