This commit is contained in:
2021-08-24 18:24:46 +08:00
parent 575f4b8520
commit 24c93edf2b
110 changed files with 5 additions and 6 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace Kafka;
use RdKafka\Message;
class Struct
{
public ?int $offset;
public ?Message $message;
public ?string $topic;
public mixed $value;
public ?int $part;
/**
* Struct constructor.
* @param string $topic
* @param Message $message
*/
public function __construct(string $topic, Message $message)
{
$message->payload = swoole_unserialize($message->payload);
$this->topic = $topic;
$this->offset = $message->offset;
$this->part = $message->partition;
$this->message = $message;
$this->value = $message->payload;
}
}