Hey,
I tried many different ways of doing that, and trying to get everything from documentation but maybe I'm too stupid for that :)
what i did is:
config/queue.php
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_KEY', 'no-key'),
'secret' => env('AWS_SECRET', 'no-secret'),
'queue' => env('AWS_QUEUE','no-default-queue-url'),
'region' => env('AWS_REGION','no-region')
],
and all of these are correctly in my .env file
i did new file:
app/Jobs/SlackInJob.php
<?php
namespace App\Jobs;
class SlackInJob extends Job
{
/**
* Execute the job.
*
* @return void
*/
public function handle($test,$test2)
{
return true;
}
}
and send message to queue:
{"job":"App\\Jobs\\SlackInJob","data":{"id":1,"sth":"sth"}}
but getting error:
marek@Mareks-MacBook-Pro ~/P/opsbot-messagesend> php artisan queue:listen
Fatal error: Call to undefined method App\Jobs\SlackInJob::fire() in /Users/marek/Projects/opsbot-messagesend/vendor/illuminate/queue/Jobs/Job.php on line 129
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method App\Jobs\SlackInJob::fire()
Fatal error: Call to undefined method App\Jobs\SlackInJob::fire() in /Users/marek/Projects/opsbot-messagesend/vendor/illuminate/queue/Jobs/Job.php on line 129
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method App\Jobs\SlackInJob::fire()
Fatal error: Call to undefined method App\Jobs\SlackInJob::fire() in /Users/marek/Projects/opsbot-messagesend/vendor/illuminate/queue/Jobs/Job.php on line 129
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method App\Jobs\SlackInJob::fire()
So I see that lumen is connecting with no issue to queue and getting message, the problem is that fire is abstract class in Job, so there is some reason why lumen is not loading automatically SqsJob class instead of just simple Job
I also tried to do
class SlackInMessage extend SqsJob - but they were getting:
[Illuminate\Contracts\Container\BindingResolutionException]
Unresolvable dependency resolving [Parameter #0 [ <required> array $config ]] in class Aws\Sqs\SqsClient