user2007934
user2007934

Reputation: 21

How do you configure Laravel and RabbitMQ?

Let me start by saying I am quite the novice when it comes to server development, so not being able to even setup a learning project is not my proudest moment, but here it goes:

I have a Laravel 8 project, with an AMQP wrapper installed from here: https://github.com/bschmitt/laravel-amqp. Aside from that, I have the rabbitmq:3-management Docker image running.

Now, if I try to open the management console through localhost:15672, use the guest:guest creds, everything is fine. If I try to telnet localhost 5672 and enter a random string as suggested here: http://rubybunny.info/articles/troubleshooting.html , everything is still fine.

I have an amqp.php file in my config as suggested here: https://github.com/bschmitt/laravel-amqp/issues/12, it changes nothing. I know for a fact that it changes nothing, because I at least managed to find where to hardcode my host and port, and got a bit "more positive" errors for a while, but I didn't manage to the same with the credentials.

All in all, without any hardcoding, and supposedly doing the configuration by the book, this is the error I get when I try to publish a message:

PhpAmqpLib\Exception\AMQPIOException Error Connecting to server(0): Failed to parse address ":"

Any pointers would be appreciated.

Upvotes: 1

Views: 1517

Answers (1)

user2007934
user2007934

Reputation: 21

So, all in all, I could not for the life of me figure out why my AMQP wrapper refused to have its config applied, so I removed it and went to trying to run the queue without it.

I could have been a bit more verbose in my question, what I called "more positive" errors, at best resulted in "Connection refused", which I immediately got when I went to the barebones implementation.

And because I'm still learning docker-compose from the ground up, it did not occur to me that instead of creating the connection based on "localhost", I had to use the name of the RabbitMQ container. Fixing that fixed everything.

Upvotes: 1

Related Questions