laravel-workflow: Activity doesn't execute
The workflow’s execute()
function is called, but not its first activity’s execute()
function.
The workflow class method starts with:
public function execute($email_address = '')
{
dump(__CLASS__ . '::execute()', $email_address);
yield ActivityStub::make(SendEmailAddressVerificationEmailActivity::class, $email_address);
and prints:
"App\Workflows\Tests\VerifyEmailAddress\VerifyEmailAddressWorkflow::execute()"
"test@example.com"
But the activity class method doesn’t print or log anything:
public function execute($email_address)
{
dump(__CLASS__ . '::execute()', $email_address);
Log::info('Sending to: ' . $email_address);
In the workflows
database table all started workflows have status waiting
.
I’m using Laravel 10.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (9 by maintainers)
After migrating the database and updating the QUEUE_CONNECTION as described at https://laravel.com/docs/10.x/queues#driver-prerequisites it seems to work. Thanks a lot!
I have updated the documentation. I would recommend
database
orredis
queue driver for testing workflows. Thesync
driver won’t work. If you want to hack it yourself @florisbosch has graciously provided some code for that. But you won’t be able to use timers if you go that route. I’m going to close this ticket, assuming changing the driver fixes the issue. If not, please feel free to reopen it. Thanks!Hi @wq9578 & @rmcdaniel, This issue seems to happen if you work in your local dev environment and have the queue connection set to “sync”. Because the workflow job is running it is not able to start the activity job before the workflow itself is completed.
I’ve made a pull request with a proposal for a possible solution to use the dispatchNow in the activity. See https://github.com/laravel-workflow/laravel-workflow/pull/95
@wq9578 Do you have some time for a video chat so we can screen share? That would be the fastest way to make progress at this point. The major issue right now is that we aren’t getting any error message. So we need to figure out when/where/how it’s silently dying in the middle of the workflow.
See the files at https://gist.github.com/wq9578/5e52bfc9e0e5178aa4eb99aca0ebcd71, and for the versions the log file there.
The queue doesn’t report anything, even with maximum verbosity:
php artisan queue:work -vvv
.Console:
Of course I had started the queue (and I have tested it again now).
The exact instructions were:
php artisan serve
php artisan queue:work
I also tried starting the queue first, and starting the queue only (without starting the server).
So what is the next step in debugging? The library as well as the website are nicely done, as far as I can see, so I would like to use it. Thanks!