Answer the question
In order to leave comments, you need to log in
Why am I getting an error from RabbitMQ?
The story is this, there is a service written in Laravel using GraphQL. In fact - the usual CRUD. I wanted to hang up an event for a user change mutation so that a message is sent to RabbitMQ. I have never worked with queues before, but it seems I understand the essence, read what I found, etc.
Now to the point, I call a simple code:
public function execute($message)
{
/**
* Создаёт совединение с RabbitAMQP
*/
$connection = new AMQPStreamConnection(
'hawk.rmq.cloudamqp.com', #host - имя хоста, на котором запущен сервер RabbitMQ
1883, #port - номер порта сервиса
'hbcittgb', #user - имя пользователя для соединения с сервером
'yaCPZE87Yn1XGq_Vwmg2yQCtdYrc-MIm', #password
'hbcittgb'
);
$channel = $connection->channel();
$channel->queue_declare('hello', false, false, false, false);
$msg = new AMQPMessage('Hello World!');
$channel->basic_publish($msg, '', 'hello');
$channel->close();
$connection->close();
}
Answer the question
In order to leave comments, you need to log in
It turned out to be a rather stupid story, it's just that authorization on this cloud service does not seem to work. I installed rabbitmq-server on a separate VPS and everything started up without problems.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question