File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -441,8 +441,9 @@ Committing offsets is essential when working with Kafka. Per default, messages w
441
441
async handleUserCreated (@Payload () data : IncomingMessage , @Ctx () context : KafkaContext ) {
442
442
// business logic
443
443
444
- const originalMessage = context .getMessage ();
445
- const { topic, partition, offset } = originalMessage ;
444
+ const { offset } = context .getMessage ();
445
+ const partition = context .getPartition ();
446
+ const topic = context .getTopic ();
446
447
await this .client .commitOffsets ([{ topic , partition , offset }])
447
448
}
448
449
@@switch
@@ -451,8 +452,9 @@ async handleUserCreated(@Payload() data: IncomingMessage, @Ctx() context: KafkaC
451
452
async handleUserCreated (data , context ) {
452
453
// business logic
453
454
454
- const originalMessage = context .getMessage ();
455
- const { topic, partition, offset } = originalMessage ;
455
+ const { offset } = context .getMessage ();
456
+ const partition = context .getPartition ();
457
+ const topic = context .getTopic ();
456
458
await this .client .commitOffsets ([{ topic , partition , offset }])
457
459
}
458
460
```
You can’t perform that action at this time.
0 commit comments