laravel-pubsub's People
laravel-pubsub's Issues
vladimir-yuldashev/laravel-queue-rabbitmq v11.3
У вас жесткая зависимость с v11.2?
Добавить поддержку php8
- Перейти на версию пакета vyuldashev/laravel-queue-rabbitmq v11.2.0
- В Listener сменить механику gotJob на currentJob. Так как vyuldashev/laravel-queue-rabbitmq v11.2.0 gotJob больше нету
[previous exception] [object] (ErrorException(code: 0): Undefined array key \"job\" at /app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:210)
When dispatching an event which should be broadcasted through RabbitMQ I receive the error from subject. broadcasting.default is set to "rabbitmq". Connection and queue is defined as documented.
Within my model's boot method I have:
static::saved(function ($model) {
EntitySaved::broadcast(
static::generateRoutingKey($model, 'saved'),
static::generateExchangeName($model),
$model->publishable()
)->via(config('broadcasting.default'));
});
My publishable event is:
class EntitySaved extends PublishEvent implements RoutingInformation
{
use HasRoutingInformation;
use InjectsRoutingPayload;
use RabbitMQConnection;
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
use InteractsWithQueue;
public function getExchangeType(): string
{
return 'topic';
}
}
The resulting event within horizon looks like this:
I try to listen for events with:
php artisan event:listen uploader.upload.saved --exchange=events
and also tried php artisan event:listen uploader.# --exchange=events
Start listening event uploader.upload.saved on exchange events, queue name is events
I trigger an event within artisan tinker like that to test:
Upload::find('95b55430-eadf-4ec9-970c-1eb9dcfdafdd')->update(['type' => 'avatar'])
I see that horizon is processing the events properly?!
uploader_horizon_1 | [2022-03-09 09:05:10][b6e0e01c-2a86-4727-be61-d3930e1fa9f3] Processing: Company\Common\PubSub\Events\EntitySaved
uploader_horizon_1 | [2022-03-09 09:05:10][b6e0e01c-2a86-4727-be61-d3930e1fa9f3] Processed: Company\Common\PubSub\Events\EntitySaved
But nothing appears in my pubsub_events table - neither failed, nor succeeded events and I receive the following error:
[2022-03-09 09:05:11] local.ERROR: Undefined array key "job" {"exception":"[object] (ErrorException(code: 0): Undefined array key \"job\" at /app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:315)
[stacktrace]
#0 /app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(315): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(327): Illuminate\\Queue\\Jobs\\Job->getName()
#2 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(198): Illuminate\\Queue\\Jobs\\Job->resolveName()
#3 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(180): Illuminate\\Queue\\Console\\WorkCommand->writeStatus()
#4 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(159): Illuminate\\Queue\\Console\\WorkCommand->writeOutput()
#5 /app/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(404): Illuminate\\Queue\\Console\\WorkCommand->Illuminate\\Queue\\Console\\{closure}()
#6 /app/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(249): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}()
#7 /app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(195): Illuminate\\Events\\Dispatcher->dispatch()
#8 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(581): Illuminate\\Queue\\Jobs\\Job->fail()
#9 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(527): Illuminate\\Queue\\Worker->failJob()
#10 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(455): Illuminate\\Queue\\Worker->markJobAsFailedIfWillExceedMaxAttempts()
#11 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(432): Illuminate\\Queue\\Worker->handleJobException()
#12 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\\Queue\\Worker->process()
#13 /app/vendor/chocofamilyme/laravel-pubsub/src/Listener.php(117): Illuminate\\Queue\\Worker->runJob()
#14 [internal function]: Chocofamilyme\\LaravelPubSub\\Listener->Chocofamilyme\\LaravelPubSub\\{closure}()
#15 /app/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AMQPChannel.php(1044): call_user_func()
#16 [internal function]: PhpAmqpLib\\Channel\\AMQPChannel->basic_deliver()
#17 /app/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AbstractChannel.php(220): call_user_func()
#18 /app/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AbstractChannel.php(374): PhpAmqpLib\\Channel\\AbstractChannel->dispatch()
#19 /app/vendor/chocofamilyme/laravel-pubsub/src/Listener.php(142): PhpAmqpLib\\Channel\\AbstractChannel->wait()
#20 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Chocofamilyme\\LaravelPubSub\\Listener->daemon()
#21 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#22 /app/vendor/vladimir-yuldashev/laravel-queue-rabbitmq/src/Console/ConsumeCommand.php(46): Illuminate\\Queue\\Console\\WorkCommand->handle()
#23 /app/vendor/chocofamilyme/laravel-pubsub/src/Commands/EventListenCommand.php(91): VladimirYuldashev\\LaravelQueueRabbitMQ\\Console\\ConsumeCommand->handle()
#24 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Chocofamilyme\\LaravelPubSub\\Commands\\EventListenCommand->handle()
#25 /app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#26 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#27 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#28 /app/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\\Container\\BoundMethod::call()
#29 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call()
#30 /app/vendor/symfony/console/Command/Command.php(298): Illuminate\\Console\\Command->execute()
#31 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#32 /app/vendor/symfony/console/Application.php(1015): Illuminate\\Console\\Command->run()
#33 /app/vendor/symfony/console/Application.php(299): Symfony\\Component\\Console\\Application->doRunCommand()
#34 /app/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun()
#35 /app/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\\Component\\Console\\Application->run()
#36 /app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run()
#37 /app/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#38 {main}
[previous exception] [object] (ErrorException(code: 0): Undefined array key \"job\" at /app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:210)
[stacktrace]
#0 /app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(210): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(192): Illuminate\\Queue\\Jobs\\Job->failed()
#2 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(581): Illuminate\\Queue\\Jobs\\Job->fail()
#3 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(527): Illuminate\\Queue\\Worker->failJob()
#4 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(455): Illuminate\\Queue\\Worker->markJobAsFailedIfWillExceedMaxAttempts()
#5 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(432): Illuminate\\Queue\\Worker->handleJobException()
#6 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\\Queue\\Worker->process()
#7 /app/vendor/chocofamilyme/laravel-pubsub/src/Listener.php(117): Illuminate\\Queue\\Worker->runJob()
#8 [internal function]: Chocofamilyme\\LaravelPubSub\\Listener->Chocofamilyme\\LaravelPubSub\\{closure}()
#9 /app/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AMQPChannel.php(1044): call_user_func()
#10 [internal function]: PhpAmqpLib\\Channel\\AMQPChannel->basic_deliver()
#11 /app/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AbstractChannel.php(220): call_user_func()
#12 /app/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AbstractChannel.php(374): PhpAmqpLib\\Channel\\AbstractChannel->dispatch()
#13 /app/vendor/chocofamilyme/laravel-pubsub/src/Listener.php(142): PhpAmqpLib\\Channel\\AbstractChannel->wait()
#14 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Chocofamilyme\\LaravelPubSub\\Listener->daemon()
#15 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#16 /app/vendor/vladimir-yuldashev/laravel-queue-rabbitmq/src/Console/ConsumeCommand.php(46): Illuminate\\Queue\\Console\\WorkCommand->handle()
#17 /app/vendor/chocofamilyme/laravel-pubsub/src/Commands/EventListenCommand.php(91): VladimirYuldashev\\LaravelQueueRabbitMQ\\Console\\ConsumeCommand->handle()
#18 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Chocofamilyme\\LaravelPubSub\\Commands\\EventListenCommand->handle()
#19 /app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#20 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#21 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#22 /app/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\\Container\\BoundMethod::call()
#23 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call()
#24 /app/vendor/symfony/console/Command/Command.php(298): Illuminate\\Console\\Command->execute()
#25 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#26 /app/vendor/symfony/console/Application.php(1015): Illuminate\\Console\\Command->run()
#27 /app/vendor/symfony/console/Application.php(299): Symfony\\Component\\Console\\Application->doRunCommand()
#28 /app/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun()
#29 /app/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\\Component\\Console\\Application->run()
#30 /app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run()
#31 /app/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#32 {main}
"}
Within config/pubsub.php I defined:
'listen' => [
'uploader.upload.saved' => [
'listeners' => [
UploadSaved::class,
],
],
],
Within the listener I just do Log::debug(serialize($event));
but of course it never reaches that point.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.