-
Notifications
You must be signed in to change notification settings - Fork 105
Open
Description
Given the example shown within the README.md file, we are given the following code snippet under Receiving from SQS:
use Illuminate\Contracts\Queue\Job as LaravelJob;
class HandlerJob extends Job
{
protected $data;
/**
* @param LaravelJob $job
* @param array $data
*/
public function handle(LaravelJob $job, array $data)
{
// This is incoming JSON payload, already decoded to an array
var_dump($data);
// Raw JSON payload from SQS, if necessary
var_dump($job->getRawBody());
}
}
However, it's not clear what class the HandlerJob
class is extending. We are just presented with Job
.
We can see that:
Illuminate\Contracts\Queue\Job
is already has an alias (and is aninterface
), so it's not going to be using that class.- The
Illuminate\Queue\Jobs\Job
is another potential, but that requires us to declare two methods declared in theabstract
class:getRawBody
andgetJobId
. - Using
Illuminate\Queue\Jobs\SqsJob
which seems like a potential match, throws an error when attempting to be consumed:
[2019-12-10 21:36:46] local.ERROR: Unresolvable dependency resolving [Parameter #0 [ <required> array $config ]] in class Aws\Sqs\SqsClient {"exception":"[object] (Illuminate\\Contracts\\Container\\BindingResolutionException(code: 0): Unresolvable dependency resolving [Parameter #0 [ <required> array $config ]] in class Aws\\Sqs\\SqsClient at /Users/oliver/Sites/xxx/vendor/laravel/framework/src/Illuminate/Container/Container.php:994)
So I'm a little confused with how this example should be working to receive messages from the SQS queue, and allow the handler to work on them.
Any suggestions would be helpful.
Metadata
Metadata
Assignees
Labels
No labels