nuwber/rabbitevents

Config not properly read

nenadvv opened this issue · 2 comments

Hello,
First of all to say a nice package & good work. I have an issue which I'm unable to solve:
Namely it seems that the package doesn't read the config/rabbitevents.php file & is always creating an AMQP connection with the fallback values provided in src/Amqp/Connection.php makeFactory function ie:

$factory = new AmqpConnectionFactory([
            'dsn' => $this->config->get('dsn'),
            'host' => $this->config->get('host', '127.0.0.1'),
            'port' => $this->config->get('port', 5672),
            'user' => $this->config->get('user', 'guest'),
            'pass' => $this->config->get('pass', 'guest'),
            'vhost' => $this->config->get('vhost', '/'),
            'ssl_on' => $this->config->get('ssl.is_enabled', false),
            'ssl_verify' => $this->config->get('ssl.verify_peer', true),
            'ssl_cacert' => $this->config->get('ssl.cafile'),
            'ssl_cert' => $this->config->get('ssl.local_cert'),
            'ssl_key' => $this->config->get('ssl.local_key'),
            'ssl_passphrase' => $this->config->get('ssl.passphrase'),
        ]);

When I try to dump $this->config I get an empty array. The only way I can get the package to work is if I change the fallback values inside this function in the package & after that everything works properly although I'm forced to use the events exchange which is set up as default in src/Amqp/TopicFactory.php
Versions:

nuwber/rabbitevents": "^6.0"
"php": "^7.4.7",
"laravel/framework": "^7.0",

I'm not sure if it is my fault in setting things up (shouldn't be as I've followed through the instructions you provided & everything works like it should when I change the fallback values) or the package itself.
Thanks in advance!

Well, got to the bottom of the problem, something was wrong locally as it wouldn't read strings in single quotes in config and the default value of the config array amounted to an empty string. After reinstalling Laravel it reads the config like it should. Closing as it wasn't really the packages fault, but if someone else has the same problem, try reinstalling Laravel.
Cheers!

I have a similar problem. With php artisan tinker I see that config('rabbitevents') contains the correct configuration but it still tries to connects to 127.0.0.1.

myproject_horizon_1   | In StreamIO.php line 108:
myproject_horizon_1   |                                                                                
myproject_horizon_1   |   stream_socket_client(): Unable to connect to tcp://127.0.0.1:5672 (Connecti  
myproject_horizon_1   |   on refused)