Open
Description
What's up?
In the README file the section Receiving from sqs shows a handler class which extends the Job.
There are two issues with this, in that the use
statement give in the example is an interface, so cannot be extended. If you change to implement
then you must add a significant number of extra methods from the interface.
How could it be improved?
I would suggest that it instead show extending the SqsJob
class.
use Illuminate\Queue\Jobs\SqsJob;
class SqsHandlerJob extends SqsJob
{
/**
* @var null|array $data
*/
protected $data;
/**
* @param SqsJob $job
* @param null|array $data
*/
public function handle(SqsJob $job, ?array $data): void
{
// This is incoming JSON payload, already decoded to an array
var_dump($data);
// Raw JSON payload from SQS, if necessary
var_dump($job->getRawBody());
}
}
What's your environment?
Running Laravel 10 with PHP 8.2
Metadata
Metadata
Assignees
Labels
No labels