Call to undefined method Illuminate\Queue\SyncQueue::getPsrContext()
Closed this issue · 5 comments
Hi there,
Thank for an awesome package.
I'm starting to playing around with this, think a got it all right with the config (reading your guide).
Tried different approaches and still get the same error message.
I've set up my app/config.php with
'providers' => [
/*
* Laravel Framework Service Providers...
*/
...
/*
* Package Service Providers...
*/
Enqueue\LaravelQueue\EnqueueServiceProvider::class,
Nuwber\Events\BroadcastEventServiceProvider::class,
/*
* Application Service Providers...
*/
...
App\Providers\RabbitMQEventServiceProvider::class
],
App\Http\Providers\RabbitMQEventServiceProvider.php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Nuwber\Events\BroadcastEventServiceProvider;
class RabbitMQEventServiceProvider extends BroadcastEventServiceProvider
{
/**
* Register services.
*
* @return void
*/
protected $listen = [
'item.*' => [
'App\Listeners\ItemLogger',
],
];
public function register()
{
//
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
//
}
}
App\Http\Listerns
<?php
namespace App\Listeners;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class ItemLogger
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param object $event
* @return void
*/
public function handle(string $event, array $payload)
{
//
log($event);
log($payload);
}
}
Using Laravel 5.7
Im getting this error everywhere, when a fire an event or trying to listen to events.
Call to undefined method Illuminate\Queue\SyncQueue::getPsrContext()
What have a done wrong?
Thank you!
@eckelarsson what QUEUE_DRIVER is in your .env?
I just used your config to config/queue.php did't set anything in the .env file
'interop' => [
'driver' => 'amqp_interop',
'connection_factory_class' => \Enqueue\AmqpLib\AmqpConnectionFactory::class,
'host' => 'rabbit',
'port' => 5672,
'user' => env('RABBITMQ_USER', 'guest'),
'pass' => env('RABBITMQ_PASSWORD', 'guest'),
'vhost' => '/',
'logging' => [
'enabled' => false,
'level' => 'info',
]
],
EDIT:
I did change the vhost from events to / according to my Rabbit setup.
in .env.example there's setting QUEUE_DRIVER=sync
, so laravel decided that you want to use sync
driver as queue.
The error message is "Call to undefined method Illuminate\Queue\SyncQueue::getPsrContext()", that means reason is in this setting.
It was the QUEUE_CONNECTION env that needed to change. I set it to interop and it fixed the error.
Thank you again for your time.