php-nats-streaming
php-nats-streaming copied to clipboard
Multiple notices when sending messages
Hi,
When sending messages I've receiving multiple notices
❯ php pub.php 100
PHP Notice: Undefined index: auth_required in /home/exu/src/kinguin.io/architecture/eventsourcing-nats/php/vendor/repejota/nats/src/Nats/ServerInfo.
php on line 105
PHP Notice: Undefined index: tls_required in /home/exu/src/kinguin.io/architecture/eventsourcing-nats/php/vendor/repejota/nats/src/Nats/ServerInfo.p
hp on line 106
PHP Notice: Undefined index: tls_verify in /home/exu/src/kinguin.io/architecture/eventsourcing-nats/php/vendor/repejota/nats/src/Nats/ServerInfo.ph$
on line 107
Got ACK(0) = 1
Got ACK(1) = 1
...
Does II missing someting ?
and the code.
<?php
require 'vendor/autoload.php';
$options = new \NatsStreaming\ConnectionOptions();
$options->setClientID("test");
$options->setClusterID("test-cluster");
$c = new \NatsStreaming\Connection($options);
$c->connect();
$count = 1;
if (isset($argv, $argv[1])) {
$count = (int) $argv[1];
}
for ($i = 0; $i < $count; $i++) {
$r = $c->publish('dupa', json_encode(['nats' => 'example','a'=>rand()]));
echo "Got ACK($i) = " . $r->wait() . "\n";
}
$c->close();
Hi @exu.
Looks like an issue in php-nats. Basically some headers aren't received after connecting.
Could be that you connect to something other than a nats server? You sure it's running on localhost:4222?
ServerInfo message of NATS server was changed. For check, enable debug on client.