pulsar-client-php icon indicating copy to clipboard operation
pulsar-client-php copied to clipboard

Regarding ConsumerOptions

Open g41797 opened this issue 1 year ago • 2 comments

According to implementation

   public function setReceiveQueueSize(int $size)
    {
        if ($size <= 0) {
            $size = 1000;
        }
        $this->data[ self::RECEIVE_QUEUE_SIZE ] = $size;
    }

for $size == 0 actual 'RECEIVE_QUEUE_SIZE' will be 1000.

According to recommendations: "...set the consumers' receiver queue size very low (potentially even to 0 if necessary)..."

I cannot override setReceiveQueueSize, because ConsumerOptions is final.

If you agree, I will create PR with fix, something like

   public function setReceiveQueueSize(int $size)
    {
        if ($size < 0)
        {
            $size = 1000;
        }
        $this->data[ self::RECEIVE_QUEUE_SIZE ] = $size;
    }

meanwhile I will use public $data directly

g41797 avatar May 27 '24 08:05 g41797

I tested it and set it to 0, the consumer will not receive the message. I don't quite understand why this use case is needed, but if you need it, you can submit a PR.

ikilobyte avatar May 27 '24 09:05 ikilobyte

Re-opened just FYI:

Looks as client side issue

g41797 avatar May 31 '24 02:05 g41797