Skip to content

Commit dee754f

Browse files
committed
Connection timeout to try KafkaJS
1 parent 20a1321 commit dee754f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/kafkajs/consumer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ async function consumerStart() {
66
const kafka = new Kafka({
77
brokers: ['pkc-8w6ry7.us-west-2.aws.devel.cpdev.cloud:9092'],
88
ssl: true,
9+
connectionTimeout: 5000,
910
sasl: {
1011
mechanism: 'plain',
1112
},
@@ -15,7 +16,9 @@ async function consumerStart() {
1516
},
1617
onPartitionsRevoked: async (assignment) => {
1718
console.log(`Revoked partitions ${JSON.stringify(assignment)}`);
18-
await consumer.commitOffsets();
19+
await consumer.commitOffsets().catch((e) => {
20+
console.error(`Failed to commit ${e}`);
21+
})
1922
}
2023
},
2124
rdKafka: {

0 commit comments

Comments
 (0)