April 2018
Beginner
226 pages
4h 47m
English
Moving on, let's implement the consumer concepts to our real-time app. This will complete our JSON message-passing implementation using Kafka. We are going to work on app.js for now, as it is a consumer for us:
const kafka = require('kafka-node'), client = new kafka.Client(), consumer = new kafka.Consumer(client, [{ topic: 'pinBoard', offset: 0 }], { autoCommit: false } );
Here, we have created a consumer instance that connects to Kafka with topics that are passed as array parameters to the kafka.Consumer method.
Read now
Unlock full access