Skip to content

Commit 3e4c9b9

Browse files
committed
refactor: remove getLastSeqNo option and adjust handling for duplicates in TopicWriterOptions
Signed-off-by: Vladislav Polyakov <[email protected]>
1 parent 9023608 commit 3e4c9b9

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

packages/topic/src/writer/index.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@ export type TopicWriterOptions = {
3131
// If not provided, a random producer name will be generated.
3232
// If provided, the producer name will be used to identify the writer.
3333
producer?: string
34-
// Automatically get the last sequence number of the topic before starting to write messages.
35-
// If not provided, the writer will not get the last sequence number.
36-
// This is useful to ensure that the writer starts writing messages after the last message in the topic.
37-
// If true, the writer will get the last sequence number of the topic before starting to write messages.
38-
getLastSeqNo?: boolean
3934
// Allow duplicates in the topic, default is false.
4035
// If true, the writer will write messages without producerId.
4136
allowDuplicates?: boolean
37+
// Allow duplicates in the topic, default is false.
38+
// If true, the writer will write messages without producerId.
39+
withoutDeduplication?: boolean
4240
// How often to update the token for the writer.
4341
// Default is 60 seconds.
4442
updateTokenIntervalMs?: number
@@ -77,12 +75,9 @@ export interface TopicWriter extends Disposable, AsyncDisposable {
7775
export function createTopicWriter(driver: Driver, options: TopicWriterOptions): TopicWriter {
7876
// Generate a random producer name if not provided.
7977
options.producer ??= _get_producer_id();
80-
// Automatically get the last sequence number of the topic before starting to write messages.
81-
options.getLastSeqNo ??= true;
82-
// Allow duplicates in the topic, default is false.
83-
if (options.allowDuplicates) {
78+
// If duplicates are not allowed, the producerId is used.
79+
if (options.withoutDeduplication) {
8480
options.producer = undefined; // If duplicates are allowed, producerId is not used.
85-
options.getLastSeqNo = false; // If duplicates are allowed, we don't need to get the last sequence number.
8681
}
8782
// Default intervals
8883
options.flushIntervalMs ??= 60_000; // Default is 60 seconds.

0 commit comments

Comments
 (0)