I need to make a delayed email sending, decided to use yii2-queue component for this. But it seem not to work. I’ve been trying to just write some data in file to text it and it stays empty…
The job class:
<?php
namespace app\models;
use yii\base\Object;
class WriteJob extends Object implements \yii\queue\Job
{
public $text;
public $file;
public function execute($queue)
{
file_put_contents($this->file, $this->text);
}
}
Just the code I wrote… I have my yii2 project just locally in OpenServer on windows, so I have no cron… I’ll have to upload it on real linux server later and it should work, I don’t have all permissions on that server…
Aren’t yii queue/run and Yii::$app->queue ->run() the same thing? Isn’t a way to run it without console? The thing is the project is on open server now and i’ll upload it on real linux server later.
I ran yii queue/listen now, it says “worker is started” but text files remains empty when I call the controller…
@samdark@tyhja-mitaton Hello, I’ve followed this trend, and it was very helpful. I’ve a yii2 advanced setup and I’m generating the job from the backend (I’m using the file driver). I’ve found that the jobs are being created under /backend/runtime/queue but when I run php yii queue I just get the following:
Jobs
waiting: 0
delayed: 0
reserved: 0
done: 0
As the queue/run command runs at the console and not at the backend, how can I manage to send this jobs to console runtime directory instead of backend? Any setting I’m missing out? Or should I just create a OS job to move them to the desired location?