Skip to content

Commit adc99b1

Browse files
committed
export retries
1 parent d025831 commit adc99b1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/service-utils/src/node/kafka.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ const { CompressionCodecs } = KafkaJS;
1010
* Reference: https://kafka.js.org/docs/producing#producing-messages
1111
*/
1212
export interface KafkaProducerSendOptions {
13+
// Per-message settings.
1314
acks?: number;
1415
timeout?: number;
16+
17+
// Per-producer settings.
18+
retries?: number;
1519
allowAutoTopicCreation?: boolean;
1620
maxInFlightRequests?: number;
1721
}
@@ -114,6 +118,7 @@ export class KafkaProducer {
114118
this.producer = this.kafka.producer({
115119
allowAutoTopicCreation: options?.allowAutoTopicCreation ?? false,
116120
maxInFlightRequests: options?.maxInFlightRequests ?? 1000,
121+
retry: { retries: options?.retries ?? 5 },
117122
});
118123
await this.producer.connect();
119124
}

0 commit comments

Comments
 (0)