Laravel/GPS not working with Queued Event Listeners
Hi, I'm using the enqueue/laravel-queue and the enqueue/gps packages in Laravel 5.8 and ran into an issue when trying to fire off an event which has a queued event listener, e.g. the listener implements the ShouldQueue interface in Laravel.
I'm getting this exception/stack trace:
The destination must be an instance of Enqueue\Gps\GpsTopic but got Enqueue\Gps\GpsQueue. {"exception":"[object] (Interop\\Queue\\Exception\\InvalidDestinationException(code: 0): The destination must be an instance of Enqueue\\Gps\\GpsTopic but got Enqueue\\Gps\\GpsQueue. at /container/application/vendor/queue-interop/queue-interop/src/Exception/InvalidDestinationException.php:17)
[stacktrace]
#0 /container/application/vendor/enqueue/gps/GpsProducer.php(35): Interop\\Queue\\Exception\\InvalidDestinationException::assertDestinationInstanceOf(Object(Enqueue\\Gps\\GpsQueue), 'Enqueue\\\\Gps\\\\Gps...')
#1 /container/application/vendor/enqueue/laravel-queue/src/Queue.php(70): Enqueue\\Gps\\GpsProducer->send(Object(Enqueue\\Gps\\GpsQueue), Object(Enqueue\\Gps\\GpsMessage))
#2 /container/application/vendor/enqueue/laravel-queue/src/Queue.php(54): Enqueue\\LaravelQueue\\Queue->pushRaw('{\"displayName\":...', NULL)
#3 /container/application/vendor/laravel/framework/src/Illuminate/Queue/Queue.php(44): Enqueue\\LaravelQueue\\Queue->push(Object(Illuminate\\Events\\CallQueuedListener), '', NULL)
#4 /container/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(472): Illuminate\\Queue\\Queue->pushOn(NULL, Object(Illuminate\\Events\\CallQueuedListener))
#5 /container/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(431): Illuminate\\Events\\Dispatcher->queueHandler('App\\\\Listeners\\\\J...', 'handle', Array)
It seems the Enqueue\LaravelQueue\Queue class is called by Laravel, it calls push(...) which then calls pushRaw(...), where I believe the problem starts. It then gets the context for GPS, creates a producer and sends it a Queue object with the message. The problem is Enqueue\Gps\GpsProducer expects a Topic object to be passed into it's send(...) function as it's first parameter but back at the pushRaw(...) function it passed in a Queue, this then causes the producer to throw the InvalidDestinationException.
I've looked through a lot of the code but I can't see how I can fix this on my side or how the code works when using EnqueueServiceProvider with GPS, so I thought I'd post an issue as it may be a possible bug, or possibly I'm just not using the library correctly... I dunno.
Any news on this?
We encounter this issue as well.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Same issue. I wonder if anyone actually got the GPS transport to work?
@jeroenvandergeer Unfortunately I never got this working and I had to use another solution. I ended up using kainxspirits/laravel-pubsub-queue@dev-master instead.
I ran into this same issue, looks like its still broken... Someone any idea how to fix this?