basis-company / nats.php

nats jetstream client for php
116 stars 29 forks source link

fix uninitialized payload property #64

Closed ro0NL closed 4 months ago

ro0NL commented 4 months ago

we use dispatch() for manual acking

i assume it's a proper client usage, since it fully handles response processing

i noticed for empty ack responses we get

In Client.php line 346:

  [Error]                                                                                     
  Typed property Basis\Nats\Message\Msg::$payload must not be accessed before initialization  

Exception trace:
  at /app/vendor/basis-company/nats/src/Client.php:346
 Basis\Nats\Client->onMessage() at /app/vendor/basis-company/nats/src/Client.php:325
 Basis\Nats\Client->process() at /app/vendor/basis-company/nats/src/Client.php:177
 Basis\Nats\Client->request() at /app/vendor/basis-company/nats/src/Client.php:129

this solves it

cc @nekufa :)

ro0NL commented 4 months ago

actually no, publish is sufficient for manual acking