Streaming Cassandra's query result over ZeroMQ sockets
To start the server:
Setup following env variables
export NODE_ENV=development export CASSANDRA_SERVER1=192.168.56.101 export CASSANDRA_SERVER2=192.168.56.101 export CASSANDRA_SERVER3=192.168.56.101 export CASSANDRA_USERNAME= export CASSANDRA_PASSWORD= export CASSANDRA_EVENTS_KEYSPACE_NAME=simpl_events_production
Start server using: LOG_LEVEL=INFO node server.js
In a separate tab, start client using: node client.js
There are several ways you can request for data streams:
- cassandra_query
var req_args = { 'domain': 'cassandra_query', 'query': "SELECT bucket_id, dateOf(event_timestamp) AS d FROM api_events LIMIT 200000", 'fetchSize': 5, } socket.send(JSON.stringify(req_args));
2. cassandra_fetch
var req_args = { 'domain': 'cassandra_fetch', 'from': 'date_2016_02_01', 'to': 'date_2016_05_25', 'fetchSize': 10, } socket.send(JSON.stringify(req_args));
Check out sample clients client.js
, client2.js
, client_c_fetch.js
etc.