Tuesday, September 10, 2013

Query cassandra within jaggery.js

jaggery.js at 0.9.0-ALPHA-3 does not have Cassandra database engine support out of the box.

So you need to place cassandra connector libs within {JAGGERY_HOME}/carbon/repository/components/lib/ directory or use Cassandra feature enabled carbon product.

I'm going to use enterprise-store[1] from the branch social to develop this sample script.

Create jaggery file select.jag inside your jaggery app.

and put the following script inside select.jag,

<%
var db = new Database("jdbc:cassandra://localhost:9160/EVENT_KS","admin","admin",{"driverClassName":"org.apache.cassandra.cql.jdbc.CassandraDriver"});
var result;
db.query("USE EVENT_KS");
result = db.query("SELECT * FROM org_wso2_bam_phone_retail_store_kpi");
print(result);

%>

This[2] might help to publish data into Cassandra within jaggery.

[1] https://github.com/wso2/enterprise-store
[2] http://udarakr.blogspot.com/2013/09/publish-data-to-cassandra-from.html

No comments:

Post a Comment