File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -574,7 +574,10 @@ class KafkaSSE {
574574 /**
575575 * Given a kafkaMessage consumed from node-rdkafka KafkaConsumer,
576576 * This will update the this.latestOffsetsMap with the kafkaMessage's
577- * topic, partition, and offset + 1.
577+ * topic, partition, and offset|timestamp + 1.
578+ *
579+ * NOTE: + 1 is necessary for Last-Event-ID for EventSource auto-resuming on reconnect.
580+ * Without the + 1, the previously consumed message will be reconsumed.
578581 *
579582 * @param {KafkaMessage } kafkaMessage
580583 */
@@ -591,12 +594,9 @@ class KafkaSSE {
591594
592595 // Set either timestamp or offset, depending on the configuration of useTimestampForId
593596 if ( this . options . useTimestampForId ) {
594- this . latestOffsetsMap [ `${ kafkaMessage . topic } /${ kafkaMessage . partition } ` ] . timestamp = kafkaMessage . timestamp ;
597+ this . latestOffsetsMap [ `${ kafkaMessage . topic } /${ kafkaMessage . partition } ` ] . timestamp = kafkaMessage . timestamp + 1 ;
595598 }
596599 else {
597- // TODO: Should we send offset + 1 or just offset? +1 is the easiest way to avoid
598- // duplicates during auto-resume. But, if this message doesn't
599- // make it to the client, they will skip it during auto resume.
600600 this . latestOffsetsMap [ `${ kafkaMessage . topic } /${ kafkaMessage . partition } ` ] . offset = kafkaMessage . offset + 1 ;
601601 }
602602
You can’t perform that action at this time.
0 commit comments