好几天了,我被广播节目困住了。
我有
-AWS弹性beantalk设置。
-推杆配置有以下配置
BROADCAST_DRIVER=pusher
QUEUE_DRIVER=database
运行laravel主管。
使用Laravel版本 5.5
ConvertVideoForStreaming
VideoProcessingStarted
此事件称为作业在后端开始处理。
在我使用
在本地尝试时效果很好 php artisan queue:work --timeout=0 --tries=1
但是当我尝试使用主管时,作业将被执行,但不会调度从内部作业调用的事件。
我仍然不确定为什么要这样做,请使用artisan命令在本地工作,而不要与在aws服务器上运行的超级用户一起工作。
弹性beantalk的主管配置:
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=20 ; (min. avail process descriptors;default 200)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:queue]
command=php artisan queue:work database --tries=3 --timeout=0 --queue=notifications,default
directory=/var/app/current
stdout_logfile=/var/app/current/storage/logs/supervisor.log
redirect_stderr=true
事件类: VideoProcessingStarted
class VideoProcessingStarted implements ShouldBroadcastNow
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $videoID;
public $offerID;
// public $queue = 'notifications'; //Queue Name
public function __construct($video)
{
$this->videoID = $video->id;
$this->offerID = $video->offer->id;
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('videos-processing.'.$this->videoID);
}
}
职位: ConvertVideoForStreaming
class ConvertVideoForStreaming implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $video;
public $disk;
public $dateTimeStringNow;
public function __construct(OfferLibrary $video,$disk)
{
$this->video = $video;
$this->disk = $disk;
$this->dateTimeStringNow = Carbon::now()->toDateTimeString();
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
/*
* TotalJobStatuses
* 1 - queue (meaning processing is pending)
* 2 - processing (job has been started and in progress)
* 3 - success (job has been processed and got completed successfully)
* 4 - failed (job has been processed, but failed to complete)
* */
event(new VideoProcessingStarted($this->video));
event(new VideoProcessingFailed($this->video->id));
event(new VideoProcessingQueued($this->video));
\Log::info('this should work, why not working, i dont know.::'.$this->video->id);
return null;
}
作业内部的事件被完全忽略,没有错误,没有。
event(new VideoProcessingStarted($this->video));
event(new VideoProcessingFailed($this->video->id));
event(new VideoProcessingQueued($this->video));
但是最后一条日志信息行必须执行并记录在laravel.log文件中
\Log::info('this should work, why not working, i dont know.::'.$this->video->id);
我不知道为什么,但是事件在本地计算机上运行良好,但是当我在aws服务器上的超级用户上尝试运行该事件时,内部作业只会忽略它们。