I'm trying to wrap my head around Laravel's queued event listener vs jobs.
To me, it seems like that both are very similar:
- Both implement the
ShouldQueue
interface (in the case of event listener, this is an option) - Both implement the
handle()
andfailed()
(optional) methods to perform their respective tasks.
Essentially, to me, both are queued items that can be run asynchronously.
What I am able to distinguish so far is that jobs have more "advanced" features/configurations like $timeout
, $tries
properties and you may also delay the 'trigger' of a job (courtesy of the Illuminate\Bus\Queueable
trait).
There are more I'm sure, but I'm pointing out the one that pops out to me.
So, the question is, what's the actual difference between the two and more importantly, when do you favor one over the other?