Download the PHP package justblackbird/amphp-priority-emitter without Composer
On this page you can find all versions of the php package justblackbird/amphp-priority-emitter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download justblackbird/amphp-priority-emitter
More information about justblackbird/amphp-priority-emitter
Files in justblackbird/amphp-priority-emitter
Package amphp-priority-emitter
Short Description In-memory implementation of async emitter with prioritized messages
License MIT
Informations about the package amphp-priority-emitter
AMP priority emitter
In-memory implementation of async emitter with prioritized messages
Why
Implementation of AMP Emitter is backed by a queue. It covers many cases but sometimes a priority queue is needed.
For example, you're building a bot for a social network or a messenger. Assume that the bot can react for users' commands and broadcast information to all its subscribers. These two types of messages have different priorities. Commands' responses must be sent as soon as possible to keep UX responsive but broadcasting messages can wait for a while.
You can build the app around a message bus. There is some code that pushes messages to the bus, and some code that pull them out and transfer to social network API.
You cannot use Emitter shipped with AMP because in such case broadcasting messages will block command ones because there is no way to set priority with AMP Emitter.
This library adds and Emitter with API similar to AMP Emitter but with priority support.
Installation
Usage
License
MIT (c) Dmitry Simushev
The implementation is based on AMP Emitter.
All versions of amphp-priority-emitter with dependencies
amphp/amp Version ^2.4
react/promise Version ^2
justblackbird/stable-priority-queue Version ^0.1.0