nuwber / rabbitevents

Nuwber's RabbitEvents provides a simple observer implementation, allowing you to publishing and handling for various events that occur in your applications. For example, if you need to react to some event occurred in another API.
MIT License
121 stars 36 forks source link

Connection option is not working #98

Open zek opened 2 years ago

zek commented 2 years ago

Defining connection option in the command line is not working. Always using default connection

php artisan rabbitevents:listen queue --connection="custom"

I suspect it is because of following line

https://github.com/nuwber/rabbitevents/blob/7.x/src/RabbitEvents/Foundation/RabbitEventsServiceProvider.php#L42

masterjus commented 2 years ago

It also requires to add an additional functionality for publishing.

SomeEvent::connection('custom')->publish([]);

and the helper function should receive parameters like

publish('event.name', $payload, $parameters = ['connection' => 'custom']);

The connection config couldn't be resolved in the boot method of the service provider as it does now.