26 lines
656 B
PHP
26 lines
656 B
PHP
<?php
|
|
|
|
namespace app\queue\redis;
|
|
|
|
use app\event\GoogleAdsCustomers;
|
|
use Webman\Event\Event;
|
|
use Webman\RedisQueue\Consumer;
|
|
|
|
class GoogleAdsCustomerQueue implements Consumer
|
|
{
|
|
// 要消费的队列名
|
|
public $queue = GoogleAdsCustomers::add_queue;
|
|
|
|
// 连接名,对应 plugin/webman/redis-queue/redis.php 里的连接`
|
|
public $connection = 'default';
|
|
|
|
// 消费
|
|
public function consume($data)
|
|
{
|
|
dump($this->queue.' consumed',$data);
|
|
Event::emit(GoogleAdsCustomers::add_queue, $data);
|
|
// 无需反序列化
|
|
// var_export($data); // 输出 ['to' => 'tom@gmail.com', 'content' => 'hello']
|
|
}
|
|
|
|
} |