package com.pearson.mathxl.gradebookdemo.backend.grades;
import akka.actor.UntypedActor;
import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.Session;
import com.typesafe.config.ConfigFactory;
public class InsertGradeActor extends UntypedActor {
private final String cassandraHost = ConfigFactory.load().getString("cassandra.host");
private final Cluster cluster = Cluster.builder().addContactPoint(cassandraHost).build();
private final Session session = cluster.connect("gradebook");
private final PreparedStatement insertStatment = session.prepare("UPDATE scores SET scores[?] = ? WHERE courseId = ? AND assignmentId = ?;");
private final BoundStatement bs = new BoundStatement(insertStatment);
@Override
public void onReceive(Object message) throws Exception {
Grade grade = (Grade)message;
bs.setString(0, grade.getStudentId());
bs.setInt(1, grade.getScore());
bs.setString(2, grade.getCourseId());
bs.setString(3, grade.getAssignmentId());
session.execute(bs);
getSender().tell("Done!", getSelf());
}
}I'm interested in using cassandra as the database for a play application. However, I'm not sure how to use any cassandra client (Hector, Astyanax, Datastax) with play. Does anyone know of example Play apps that demonstrate how to use hector, astyanax, or datastax with play? Thanks.
-Ari
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.