Created
March 4, 2016 09:48
-
-
Save erangaeb/339379949f64f81aafa1 to your computer and use it in GitHub Desktop.
Cassandra based database component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package components | |
| import com.datastax.driver.core.querybuilder.QueryBuilder | |
| import db.SenzCassandraCluster | |
| /** | |
| * Cassandra based MsgDbComp implementation | |
| */ | |
| trait CassandraTransDbComp extends MsgDbComp { | |
| this: SenzCassandraCluster => | |
| val msgDb = new CassandraMsgDB | |
| class CassandraMsgDB extends MsgDb { | |
| override def saveMsg(msg: String) = { | |
| // insert query | |
| val statement = QueryBuilder.insertInto("Message") | |
| .value("msg", msg) | |
| session.execute(statement) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment