Commit faa37088 authored by Tobias Steiner's avatar Tobias Steiner
Browse files

Add a counter to control the app

parent abfacb93
......@@ -114,9 +114,9 @@
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"avsc": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/avsc/-/avsc-5.3.0.tgz",
"integrity": "sha512-P0izoN7HA+REPZin0LMtqTl/s8wSyeDK8iZttkrfrMZTqL6W9sSCX3UtzJYhsM8X9IkvAUB5k/7GJbAE14KNMA=="
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/avsc/-/avsc-5.3.1.tgz",
"integrity": "sha512-iWcxc2dJe05ZpLCehwBTQ3njpK28t2/uJmCfCFUVtn04y3b7zgzk3V2LPfT1z7CAbtUeu7MfNBldeN+OqxMYyw=="
},
"aws-sign2": {
"version": "0.7.0",
......@@ -546,7 +546,7 @@
"dev": true
},
"geolinker-common": {
"version": "git+https://gitlab+deploy-token-1:vnsdCm_t84QGVA2U4kw4@source.dodis.ch/histhub/geolinker-common.git#d6baf8dfb817a5d856688c55e860210a8fba8f61",
"version": "git+https://gitlab+deploy-token-1:vnsdCm_t84QGVA2U4kw4@source.dodis.ch/histhub/geolinker-common.git#474cbcc3cbf5882f59bf92c7db39b2e5bef7f150",
"from": "git+https://gitlab+deploy-token-1:vnsdCm_t84QGVA2U4kw4@source.dodis.ch/histhub/geolinker-common.git",
"requires": {
"@types/es6-promise": "^3.3.0",
......@@ -554,6 +554,7 @@
"@types/request": "^2.47.0",
"@types/winston": "^2.3.9",
"axios": "^0.18.0",
"bunyan-format": "^0.2.1",
"concurrently": "^3.5.1",
"cpu-stat": "^2.0.1",
"js-yaml": "^3.11.0",
......@@ -562,6 +563,7 @@
"ramda": "^0.25.0",
"request": "^2.87.0",
"source-map-support": "^0.5.6",
"through2": "^2.0.3",
"typescript": "^2.8.3",
"winston": "^2.4.2"
}
......@@ -666,6 +668,11 @@
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
......@@ -719,9 +726,9 @@
}
},
"kafka-avro": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/kafka-avro/-/kafka-avro-1.0.4.tgz",
"integrity": "sha512-5fJrf8GP/Qo+7iysZZtvolv9JkzkhX1DDnfAId4jaZirqui52zWc/mYaRsk3PWvVerKCuTw1YnB90PGTOuc/4g==",
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/kafka-avro/-/kafka-avro-1.0.5.tgz",
"integrity": "sha512-chmFERtgf7nK8wtJ+mErT6PdoeR4Qhs0sInVUs2XzOqcTd090imSCESJ7MNwtYs4rFvijnT/JcHYc3M7Wle+aA==",
"requires": {
"avsc": "^5.2.3",
"axios": "^0.15.3",
......@@ -861,9 +868,9 @@
}
},
"node-rdkafka": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/node-rdkafka/-/node-rdkafka-2.3.3.tgz",
"integrity": "sha512-2J54zC9+Zj0iRQttmQs1Ubv8aHhmh04XjP3vk39uco7l6tp8BYYHG4XRsoqKOGGKjBLctGpFHr9g97WBE1pTbg==",
"version": "2.3.4",
"resolved": "https://registry.npmjs.org/node-rdkafka/-/node-rdkafka-2.3.4.tgz",
"integrity": "sha512-ilaAOrEpDF3TGTlItsxU5pQXG+qjN1gKbhSvs9CoLXZaItt2EN6oU+kEdO6UkRQLKO6/Kv4m296cBrr0JCmiTw==",
"requires": {
"bindings": "1.x",
"nan": "2.x"
......@@ -916,6 +923,11 @@
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
},
"process-nextick-args": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
},
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
......@@ -931,6 +943,20 @@
"resolved": "https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz",
"integrity": "sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ=="
},
"readable-stream": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
......@@ -1077,6 +1103,14 @@
}
}
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
},
"strip-ansi": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz",
......@@ -1093,6 +1127,22 @@
"has-flag": "^1.0.0"
}
},
"through2": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz",
"integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=",
"requires": {
"readable-stream": "^2.1.5",
"xtend": "~4.0.1"
},
"dependencies": {
"xtend": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
}
}
},
"tough-cookie": {
"version": "2.3.4",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz",
......@@ -1232,6 +1282,11 @@
"punycode": "^2.1.0"
}
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"uuid": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz",
......
import fmt = require('bunyan-format');
import {Core} from 'geolinker-common';
import Neo4jStreamWriter from './neo4j-stream-writer';
import {v1 as neo4j} from 'neo4j-driver';
import KafkaAvro = require('kafka-avro');
/**
* To trigger this you need to set the KAFKA_AVRO_LOG_LEVEL
* Move this to geolinker-common
* f.e. env KAFKA_AVRO_LOG_LEVEL=debug node dist/index.js
*/
const kafkaLog = KafkaAvro.getLogger();
kafkaLog.addStream({
type: 'stream',
stream: fmt({
outputMode: 'short',
levelInString: true,
}),
level: 'debug',
});
/**
* load sourcemap and config
......@@ -18,6 +36,7 @@ kafka.init().then(() => {
kafka.getConsumerStream().then(async (consumer) => {
core.getLogger().info('Got streamConsumer');
let counter = 0;
/**
* Connect to neo4j
* @type {Driver}
......@@ -35,8 +54,12 @@ kafka.init().then(() => {
.pipe(new Neo4jStreamWriter({objectMode: true}, driver, core));
consumer.on('data', () => {
counter++;
core.getReporter().setDataIn(1);
});
setTimeout(() => {
console.log('Count : ' + counter);
}, 30000);
});
}, (err) => {
core.getLogger().error('Error while connecting to kafka');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment