crazedVic / laratasks

0 stars 0 forks source link

Laratasks

Demonstrates laravel queues and demonstrates a notification and reminder system

Notes from links:


In .env

Replace this line.

QUEUE_CONNECTION=sync

With this line.

QUEUE_CONNECTION=database


Queues

Jobs

Failed Jobs


Other tips:


Notifications:



  1. Set default queue to 'database' not sync

To add to the priority queue: dispatch((new Job)->onQueue('priority')); * see gotchas (1)


Run this worker for this project with Supervisor/CRON:


Twilio (https://github.com/laravel-notification-channels/twilio): composer require laravel-notification-channels/twilio

Enter in .env: TWILIO_ACCOUNT_SID= TWILIO_AUTH_TOKEN= TWILIO_DEBUG_TO= TWILIO_FROM=

php artisan vendor:publish --provider="NotificationChannels\Twilio\TwilioProvider"


Gotchas

  1. secondary queues are not created in the config file, you can essentially dispatch to any string you want as long as the worker knows to look for it
  2. dd() inside an item being processed by the queue worker is displayed inside the terminal
  3. DON'T make a custom notifications table like I tried, laravel makes one itself
  4. If Queue code is changed, the queue will need to be rerun or it will continue using the old code