kafkajs
kafkajs copied to clipboard
retry does not work when the error is [Broker not connected]
Describe the bug
I am using 1.14.0 on production. and configure kafka as the following
const kafka = new Kafka({
clientId: "myClientId",
brokers: "localhost:9092",
logLevel: logLevel.WARN,
retry: {
initialRetryTime: 100,
retries: 10000
}
})
const producer = kafka.producer({ maxInFlightRequests: 1 })
await producer.connect()
producer.send(
{topic: "***.***", messages: "msg"}
)
and expect it could retry many times when error happens. But I saw logs on production. the last log is
{"level":"ERROR","timestamp":"2021-01-22T01:36:46.484Z","logger":"kafkajs","message":"[Producer] Broker not connected","retryCount":1,"retryTime":142}
and it didn't retry.
To Reproduce Please provide either a link to a:
If none of the above are possible to provide, please write down the exact steps to reproduce the behavior:
- Run a producer that continuously produces messages to a topic
- Run a consumer that subscribes to that topic and logs each topic offset
- After the consumer has consumed 100 messages, it...
Expected behavior
the send message could get retries
Observed behavior A clear and concise description of what did happen. Please include any relevant logs with the log level set to debug.
Environment:
- OS: [e.g. Mac OS 10.15.3]
- KafkaJS version: 1.14.0
- Kafka version [e.g. 2.3.1]
- NodeJS version [e.g. 10.13.0]
Additional context Add any other context about the problem here.
The same problem repeats
Same problem here, retry does not occur and an exception is thrown with: "Producer - Broker not connected"
OS: Alpine KafkaJS version: 1.15.0 Kafka version 2.3.1 NodeJS version 16.13
I am also experiencing the same issue.