改名
This commit is contained in:
+3
-3
@@ -45,11 +45,11 @@ class Producer extends Component
|
|||||||
if (!class_exists(Conf::class)) {
|
if (!class_exists(Conf::class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->conf = new Conf();
|
$this->conf = di(Conf::class);
|
||||||
$this->topicConf = new TopicConf();
|
|
||||||
$this->conf->setErrorCb(function ($kafka, $err, $reason) {
|
$this->conf->setErrorCb(function ($kafka, $err, $reason) {
|
||||||
$this->error(sprintf("Kafka error: %s (reason: %s)", rd_kafka_err2str($err), $reason));
|
$this->error(sprintf("Kafka error: %s (reason: %s)", rd_kafka_err2str($err), $reason));
|
||||||
});
|
});
|
||||||
|
$this->topicConf = di(TopicConf::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ class Producer extends Component
|
|||||||
*/
|
*/
|
||||||
private function getProducer(): \RdKafka\Producer
|
private function getProducer(): \RdKafka\Producer
|
||||||
{
|
{
|
||||||
return Snowflake::createObject(\RdKafka\Producer::class, [$this->conf]);
|
return Snowflake::getDi()->get(\RdKafka\Producer::class, [$this->conf]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ class Struct
|
|||||||
/**
|
/**
|
||||||
* Struct constructor.
|
* Struct constructor.
|
||||||
* @param $topic
|
* @param $topic
|
||||||
* @param $message
|
* @param Message $message
|
||||||
*/
|
*/
|
||||||
public function __construct($topic, Message $message)
|
public function __construct($topic, Message $message)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ class TaskContainer extends BaseObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $topic
|
* @param string $topic
|
||||||
* @return mixed|null
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getConsumer(string $topic)
|
public function getConsumer(string $topic): mixed
|
||||||
{
|
{
|
||||||
return $this->_topics[$topic] ?? null;
|
return $this->_topics[$topic] ?? null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user