Nexus API Reference

ThreadQueueHandler
in package
implements Handler

Read onlyYes
FinalYes
Tags
psalm-api

Producer-side Handler that formats a Record into a string and pushes it onto a shared Swoole\Thread\Queue. A separate writer thread drains the queue and performs the actual file/stream I/O.

Benefits over FileHandler:

  • No per-write flock(LOCK_EX) contention (only one process opens the file).
  • No per-write open()/close() syscalls (writer keeps the fd hot).
  • Naturally batches under load — writer processes pushes as fast as it can.

The queue is unbounded for the prototype; production would add a max length + drop-on-overflow policy.

Table of Contents

Interfaces

Handler

Methods

__construct()  : mixed
handle()  : void

Methods


        
On this page

Search results