Commit 9fb27288 authored by tobinski's avatar tobinski
Browse files

add checks

parent 590ab19b
Pipeline #3419 passed with stage
in 2 minutes and 47 seconds
......@@ -7,7 +7,7 @@ const shajs = require('sha.js');
*/
class UrlResolver {
private urlEventEmitter;
private producer;
private producer = null;
static baseUrl = 'http://url-resolver/v1/urltoprovider/';
constructor() {
UrlResolver.baseUrl = core.getNconf().get('url-resolver');
......@@ -75,10 +75,11 @@ class UrlResolver {
*/
public async initKafka() {
console.log("initKafka");
const kafka = core.getKafkaAvro();
await kafka.init();
const consumer = await kafka.getConsumer('url');
this.producer = await kafka.getProducer('url');
try {
const kafka = core.getKafkaAvro();
await kafka.init();
const consumer = await kafka.getConsumer('url');
this.producer = await kafka.getProducer('url');
consumer.consume();
consumer.on('data', (rawData) => {
// emit a separate event for each key. The key is the identifier for the request
......@@ -104,6 +105,12 @@ class UrlResolver {
// active trigger a consume every 10s
// https://github.com/Blizzard/node-rdkafka/issues/182
setTimeout(() => consumer.consume(), 10000);
console.log("Kafka ready");
} catch(error) {
console.log("kafka fucked up")
console.log(error);
}
}
}
......
Supports Markdown
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