Closed mqwerty closed 3 years ago
RoadRunner config:
jobs:
workers.command: "php /app/j.php"
amqp.addr: amqp://guest:guest@rabbitmq:5672/
pipelines:
local:
broker: "amqp"
queue: "local.test"
exchange: "local.test"
consume: ["local"]
dispatch:
app-job-*.pipeline: "local"
RabbitMQ config:
{
"queues": [
{
"name": "local.test",
"vhost": "/",
"durable": true,
"auto_delete": false,
"arguments": {}
}
],
"bindings": [
{
"source": "local.test",
"vhost": "/",
"destination": "local.test",
"destination_type": "queue",
"routing_key": "local.test",
"arguments": {}
}
],
"exchanges": [
{
"name": "local.test",
"vhost": "/",
"type": "direct",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
}
]
}
But when i send message through RPC - it works and no error, although the headings are the same.
use Spiral\Goridge\RPC;
use Spiral\Goridge\SocketRelay;
chdir(__DIR__);
require_once __DIR__ . '/vendor/autoload.php';
$rpc = new RPC(new SocketRelay('127.0.0.1', 6001));
$rpc->call('jobs.Push', [
'job' => 'local.test',
'payload' => 'test',
'options' => ['pipeline' => 'local']
]);
Weird. https://dev.to/sergey_telpuk/send-job-from-node-app-to-php-app-via-queue-8do Sending messages from other clients is def possible and tested.
We have to check what headers received by the AMQP broker. This is weird.
With php-amqp works fine.
$id = bin2hex(random_bytes(16));
$headers = ['headers' => [
'rr-id' => $id,
'rr-attempt' => 0,
'rr-job' => 'local.test',
]];
$connect = (new AMQPConnection(
[
'host' => 'rabbitmq',
'port' => 5672,
'login' => 'guest',
'password' => 'guest',
]
));
$connect->pconnect();
$exchange = new AMQPExchange(new AMQPChannel($connect));
$exchange->publish('test', 'local.test', AMQP_MANDATORY, $headers);
The problem is only with php-amqplib client. But in RabbitMQ admin panel i see 'rr-attempt' header. It is really strange that RoadRunner does not see it.
Maybe it uses some legacy format of headers...
Feel free to re-open this issue for the RR2 and new jobs plugin (will be soon in 2.4.0-beta1) if you get the same behavior. This repo now is deprecated for the golang part.
RoadRunner, PHP Application Server Version: 2.4.18, 2020-05-23T19:45:45+0300
Screenshot from RabbitMQ admin panel:
The same error when I send a message from the RabbitMQ admin panel.