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
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace Kafka;
use Kiri\Abstracts\BaseObject;
/**
* Class KafkaProvider
* @package Kafka
*/
class KafkaProvider extends BaseObject
{
private array $_topics = [];
/**
* @param $topic
* @param $handler
*/
public function addConsumer($topic, $handler)
{
if (isset($this->_topics[$topic])) {
return;
}
$this->_topics[$topic] = $handler;
}
/**
* @param string $topic
* @return mixed
*/
public function getConsumer(string $topic): mixed
{
return $this->_topics[$topic] ?? null;
}
}