-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient2.js
More file actions
31 lines (24 loc) · 999 Bytes
/
client2.js
File metadata and controls
31 lines (24 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//global.log = require('./config/logger.js');
var zeromq = require('zmq')
, port = 'tcp://127.0.0.1:12345';
//var zeromq_monitoring_service = require('./services/zeromq_monitoring_service.js');
var socket = zeromq.socket('dealer');
socket.identity = 'C-' + process.pid;
socket.connect(port);
console.log('Connected on '+port);
//new zeromq_monitoring_service(socket).initiateMonitoring();
var req_args = {
'domain': 'cassandra_query',
'query': "SELECT event_timestamp, event_name, bucket_id FROM api_events WHERE bucket_id = 'date_2016_05_24' AND event_name = 'UserApprovedEvent' OR event_name = 'TransactionChargedEvent' LIMIT 1000",
'fetchSize': 10,
}
socket.send(JSON.stringify(req_args));
// receving the data from server
socket.on('message', function(data) {
console.log('[' + socket.identity + ']: ' + data);
});
process.on('SIGINT', function() {
console.log("SIGINT!!!");
socket.send(JSON.stringify({'domain':'client_heartbeat', 'action':'dead'}));
socket.close();
});