I have replaced CURL calls to API with RabbitMQ RPC messages. Everything works fine with rabbitmq example
Still it looks like implementation is wrong as every request opens connection, opens channel, sends message, waits for response, gets response, closes channel and closes connection.
How can i implement RabbitMQ RPC calls to use same connection for every request using PHP?
I using https://github.com/videlalvaro/php-amqplib library
My implementation looks like this https://gist.github.com/fordnox/fa41e1233a207ec5416c
Using it like this:
$rpc = new RabbitRpc([/* config array */]);
$result = $rpc->callOnServer(1, ["foo":"bar"]);