queue icon indicating copy to clipboard operation
queue copied to clipboard

ASync reader

Open h-bragg opened this issue 8 years ago • 1 comments

Using someones implementation of an event loop and async streams, create an Asynchronous Client

removes the need for acknowledgement handler (a little bit)

interface AsyncMessageHandler {
    public function handle(MessageInterface $message, callable $done) : PromiseInterface
}

class Reader {
    public function asyncRead(AsyncMessageHandler $handler, int $num) {
        // read
        $handler->handle($message, $done)
                ->then($this->acknowledge, $this->reject);
    }
}

h-bragg avatar Jan 12 '18 09:01 h-bragg

A start I made a while ago: https://github.com/graze/queue/tree/async-queues

h-bragg avatar Jan 12 '18 11:01 h-bragg