Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: key was missing in kafka record #1862

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Event/Kafka/KafkaRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
}
$this->record = $record;
}

Check failure on line 21 in src/Event/Kafka/KafkaRecord.php

View workflow job for this annotation

GitHub Actions / PHP CodeSniffer

Whitespace found at end of line
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that this line contains 4 spaces. It should contain 0.

public function getKey(): string
{
return $this->record['key'];
}

public function getTopic(): string
{
Expand Down
1 change: 1 addition & 0 deletions tests/Event/Kafka/KafkaEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function test canonical case()
self::assertSame(15, $record->getOffset());
self::assertSame(1545084650987, $record->getTimestamp());
self::assertSame('Hello, this is a test.', $record->getValue());
self::assertSame('SGVsbG8gV29ybGQ=', $record->getKey());
self::assertSame(
[
'type' => 'core',
Expand Down
1 change: 1 addition & 0 deletions tests/Event/Kafka/kafka.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"offset":15,
"timestamp":1545084650987,
"timestampType":"CREATE_TIME",
"key": "SGVsbG8gV29ybGQ=",
"value":"SGVsbG8sIHRoaXMgaXMgYSB0ZXN0Lg==",
"headers":[
{
Expand Down
Loading