php-nats-streaming icon indicating copy to clipboard operation
php-nats-streaming copied to clipboard

Multiple notices when sending messages

Open exu opened this issue 7 years ago • 2 comments

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();

exu avatar Feb 21 '19 10:02 exu

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?

byrnedo avatar Feb 21 '19 10:02 byrnedo

ServerInfo message of NATS server was changed. For check, enable debug on client.

dimatock avatar Mar 02 '19 07:03 dimatock