From 67ed225b42f6e17e8122c4096f701ef99b11d85a Mon Sep 17 00:00:00 2001 From: Sarthak Garg Date: Thu, 30 May 2024 00:39:04 +0530 Subject: [PATCH] Added Notes for producer config and also added in the example --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index da14320..9964824 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ For more information on configuring retries, see [Retry Topic Naming Strategies] To use this module, create an `AsyncRetryHelper` object with the parameters that specify the retry delay, retry strategy, and number of retries, as in this example: ```typescript +//Note: The producer should already be connected to the Kafka cluster import AsyncRetryHelper, { RetryTopicNaming } from "kafkajs-async-retry"; const asyncRetryHelper = new AsyncRetryHelper({ @@ -122,6 +123,8 @@ const kafka = new Kafka({ }); const producer = kafka.producer(); +await producer.connect(); + const consumer = kafka.consumer({ groupId: "test-group" }); const asyncRetryHelper = new AsyncRetryHelper({