kafka-rest-consumer-daemon
v2.0.0
Published
A daemon for processing a kafka-rest topic
Downloads
6
Readme
kafka-rest-consumer-daemon
A daemon for processing a kafka-rest topic
var bunyan = require( 'bunyan' );
var kafkaRestConsumerDaemon = require( 'kafka-rest-consumer-daemon' );
var logger = bunyan.createLogger( {
name: 'stdout-daemon',
level: 'trace'
} );
function printMessages( messages, done ) {
try {
console.log( JSON.stringify( messages, null, 2 ) );
done();
} catch( err ) {
// if the messages cannot be handled, then return an error
done( err );
}
}
kafkaRestConsumerDaemon( {
kafkaRestUrl: 'http://localhost:8082',
consumerGroup: 'stdoutDaemonGroup',
consumerId: 'stdoutDaemonConsumer',
topic: 'test',
logger: logger,
consumer: printMessages
} );