mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 03:37:44 +08:00
Added event BeforeConsumerCreated
into ConsumerManager. (#6897)
This commit is contained in:
parent
2b07523528
commit
f039856130
@ -8,6 +8,7 @@
|
|||||||
- [#6876](https://github.com/hyperf/hyperf/pull/6876) Added method `Hyperf\Database\Concerns\Builder::eachById`.
|
- [#6876](https://github.com/hyperf/hyperf/pull/6876) Added method `Hyperf\Database\Concerns\Builder::eachById`.
|
||||||
- [#6878](https://github.com/hyperf/hyperf/pull/6878) Added methods `whereMorphRelation` and `orWhereMorphRelation` into `Hyperf\Database\Model\Concerns\QueriesRelationships`.
|
- [#6878](https://github.com/hyperf/hyperf/pull/6878) Added methods `whereMorphRelation` and `orWhereMorphRelation` into `Hyperf\Database\Model\Concerns\QueriesRelationships`.
|
||||||
- [#6883](https://github.com/hyperf/hyperf/pull/6883) Added methods `getIndexes` `hasIndex` and `getIndexListing` into `Hyperf\Database\Schema\Builder`.
|
- [#6883](https://github.com/hyperf/hyperf/pull/6883) Added methods `getIndexes` `hasIndex` and `getIndexListing` into `Hyperf\Database\Schema\Builder`.
|
||||||
|
- [#6897](https://github.com/hyperf/hyperf/pull/6897) Added event `BeforeConsumerCreated` into ConsumerManager.
|
||||||
|
|
||||||
## Optimized
|
## Optimized
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ use Hyperf\Di\Annotation\AnnotationCollector;
|
|||||||
use Hyperf\Kafka\Annotation\Consumer as ConsumerAnnotation;
|
use Hyperf\Kafka\Annotation\Consumer as ConsumerAnnotation;
|
||||||
use Hyperf\Kafka\Event\AfterConsume;
|
use Hyperf\Kafka\Event\AfterConsume;
|
||||||
use Hyperf\Kafka\Event\BeforeConsume;
|
use Hyperf\Kafka\Event\BeforeConsume;
|
||||||
|
use Hyperf\Kafka\Event\BeforeConsumerCreated;
|
||||||
use Hyperf\Kafka\Event\FailToConsume;
|
use Hyperf\Kafka\Event\FailToConsume;
|
||||||
use Hyperf\Kafka\Exception\InvalidConsumeResultException;
|
use Hyperf\Kafka\Exception\InvalidConsumeResultException;
|
||||||
use Hyperf\Process\AbstractProcess;
|
use Hyperf\Process\AbstractProcess;
|
||||||
@ -108,6 +109,7 @@ class ConsumerManager
|
|||||||
{
|
{
|
||||||
$consumerConfig = $this->getConsumerConfig();
|
$consumerConfig = $this->getConsumerConfig();
|
||||||
$consumer = $this->consumer;
|
$consumer = $this->consumer;
|
||||||
|
$this->dispatcher?->dispatch(new BeforeConsumerCreated($consumer, $consumerConfig));
|
||||||
$longLangConsumer = new LongLangConsumer(
|
$longLangConsumer = new LongLangConsumer(
|
||||||
$consumerConfig,
|
$consumerConfig,
|
||||||
function (ConsumeMessage $message) use ($consumer, $consumerConfig) {
|
function (ConsumeMessage $message) use ($consumer, $consumerConfig) {
|
||||||
|
24
src/kafka/src/Event/BeforeConsumerCreated.php
Normal file
24
src/kafka/src/Event/BeforeConsumerCreated.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
/**
|
||||||
|
* This file is part of Hyperf.
|
||||||
|
*
|
||||||
|
* @link https://www.hyperf.io
|
||||||
|
* @document https://hyperf.wiki
|
||||||
|
* @contact group@hyperf.io
|
||||||
|
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Hyperf\Kafka\Event;
|
||||||
|
|
||||||
|
use Hyperf\Kafka\AbstractConsumer;
|
||||||
|
use longlang\phpkafka\Consumer\ConsumerConfig;
|
||||||
|
|
||||||
|
class BeforeConsumerCreated extends Event
|
||||||
|
{
|
||||||
|
public function __construct(AbstractConsumer $consumer, public ConsumerConfig $config)
|
||||||
|
{
|
||||||
|
parent::__construct($consumer);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user