First of all, hello to all. This is my first contribution to an open source package, so please go easy on me. I'm not a software engineer, never developed professionally, but I dabble a bit in the Laravel ecosystem every now and then.
This being said, my use case is as follows: I have two apps, both using the same database as quite a lot of the data is shared between them and there was no reason to duplicate. The jobs queues are running on database connection. Both apps dispatch and process their own jobs on queues with different names. There is also a default queue which is used for processing emails and a few other bits.
Long story short: today I ran into the situation where jobs were failing at an alarming rate on one of the apps, with the following error (excerpt):
Exception: Job is incomplete class:
{"__PHP_Incomplete_Class_Name":"Spatie\\SlackAlerts\\Jobs\\SendToSlackChannelJob","webhookUrl":"https:\/\/hooks.slack.com....
This seems to happen because the wrong app was processing a job that was found on the default queue.
So I needed to have a way to somehow tell Slack Alerts that the job needs to be dispatched on a different queue than default .
The PR introduces a config option slack-alerts.queue, which gets its value from SLACK_ALERT_QUEUE in .env .
At runtime, the queue can be changed by calling onQueue() method.
First of all, hello to all. This is my first contribution to an open source package, so please go easy on me. I'm not a software engineer, never developed professionally, but I dabble a bit in the Laravel ecosystem every now and then.
This being said, my use case is as follows: I have two apps, both using the same database as quite a lot of the data is shared between them and there was no reason to duplicate. The jobs queues are running on database connection. Both apps dispatch and process their own jobs on queues with different names. There is also a
default
queue which is used for processing emails and a few other bits.Long story short: today I ran into the situation where jobs were failing at an alarming rate on one of the apps, with the following error (excerpt):
This seems to happen because the wrong app was processing a job that was found on the
default
queue.So I needed to have a way to somehow tell Slack Alerts that the job needs to be dispatched on a different queue than
default
.The PR introduces a config option
slack-alerts.queue
, which gets its value fromSLACK_ALERT_QUEUE
in.env
.At runtime, the queue can be changed by calling
onQueue()
method.Example: