How to delay consuming message in Kafka nodejs?
<p>I am using NodeJS to consume message from Kafka, after received the message , I will bring it to create an index in Elasticsearch. This is my piece of code : </p>

<pre><code>kafkaConsumer.on('message', function (message) {
    elasticClient.index({
        index: 'test',
        type: 'sample',
        body: message
    }, function (error, response) {
        if (error) {

            // Stop consuming message here

            console.log(error);
        }
        console.log(response);
    });
});
</code></pre>

<p>I want to make sure that the index must be created successfully before continue consuming next message, because I don't want any message to be lost. </p>