Files
kiri-core/Kafka/Struct.php
T

37 lines
572 B
PHP
Raw Normal View History

2020-10-09 18:43:35 +08:00
<?php
2020-10-29 18:17:25 +08:00
declare(strict_types=1);
2020-10-09 18:43:35 +08:00
namespace Kafka;
2020-10-26 17:23:22 +08:00
use RdKafka\Message;
2020-10-09 18:43:35 +08:00
class Struct
{
2020-10-26 17:23:22 +08:00
public int $offset;
2020-10-09 18:43:35 +08:00
2020-10-26 17:23:22 +08:00
public Message $message;
public string $topic;
2020-10-09 18:43:35 +08:00
2021-03-24 19:28:15 +08:00
public mixed $value;
2020-10-29 18:17:25 +08:00
public int $part;
2020-10-09 18:43:35 +08:00
/**
* Struct constructor.
* @param $topic
2021-08-04 14:33:39 +08:00
* @param Message $message
2020-10-09 18:43:35 +08:00
*/
2020-10-26 17:25:24 +08:00
public function __construct($topic, Message $message)
2020-10-09 18:43:35 +08:00
{
2021-03-24 17:57:08 +08:00
$message->payload = swoole_unserialize($message->payload);
2020-10-09 18:43:35 +08:00
$this->topic = $topic;
2020-10-26 17:23:22 +08:00
$this->offset = $message->offset;
$this->part = $message->partition;
$this->message = $message;
$this->value = $message->payload;
2020-10-09 18:43:35 +08:00
}
}