@@ -31,14 +31,12 @@ export type TopicWriterOptions = {
31
31
// If not provided, a random producer name will be generated.
32
32
// If provided, the producer name will be used to identify the writer.
33
33
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
39
34
// Allow duplicates in the topic, default is false.
40
35
// If true, the writer will write messages without producerId.
41
36
allowDuplicates ?: boolean
37
+ // Allow duplicates in the topic, default is false.
38
+ // If true, the writer will write messages without producerId.
39
+ withoutDeduplication ?: boolean
42
40
// How often to update the token for the writer.
43
41
// Default is 60 seconds.
44
42
updateTokenIntervalMs ?: number
@@ -77,12 +75,9 @@ export interface TopicWriter extends Disposable, AsyncDisposable {
77
75
export function createTopicWriter ( driver : Driver , options : TopicWriterOptions ) : TopicWriter {
78
76
// Generate a random producer name if not provided.
79
77
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 ) {
84
80
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.
86
81
}
87
82
// Default intervals
88
83
options . flushIntervalMs ??= 60_000 ; // Default is 60 seconds.
0 commit comments