romanzipp / Laravel-Queue-Monitor

Monitoring Laravel Jobs with your Database
https://packagist.org/packages/romanzipp/laravel-queue-monitor
MIT License
696 stars 92 forks source link

Is there a way to prevent Broadcasting Event from monitoring? #5

Closed darron1217 closed 6 years ago

darron1217 commented 6 years ago

Every broadcasting events are monitored by this package

How can I make exclude event from being monitored?

my event looks like this

<?php

namespace Modules\Pottophoto\Events;

use Illuminate\Queue\SerializesModels;
use Modules\Pottophoto\Entities\Project;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class ProjectRenderingProgress implements ShouldBroadcast
{
    use SerializesModels;

    public $project;
    public $progress;

    /**
     * Constructor
     *
     * @return void
     */
    public function __construct(Project $project, int $progress)
    {
        $this->project = $project;
        $this->progress = $progress;
    }

    /**
     * Get the channels the event should be broadcast on.
     *
     * @return array
     */
    public function broadcastOn()
    {
        return ['asgardcms.pottophoto.projects'];
    }
}

image

romanzipp commented 6 years ago

I'll have a look in to that

darron1217 commented 6 years ago

It may be a big change but...

How about setting monitoring disabled as a deafult?

There's lots of broadcasts from external packages in my project. I cannot add DontMonitor trait on all the jobs.

What do you think of creating EnableMonitor trait to make it as a whitelist? (instead of current blacklist system)

romanzipp commented 6 years ago

Yep, this would be the cleanest solution. I'll make the QueueMonitor trait required for the monitoring to be enabled.

romanzipp commented 6 years ago

I've released version 1.2.0 since this is a breaking change.

darron1217 commented 6 years ago

What a lightning speed 👍