drama
drama copied to clipboard
[Feature Request] message priority
Hello there,
Using a binary heap (http://eloquentjavascript.net/appendix2.html) it is possible to send prioritized messages. This helps implementing QoS (i.e. when certain actors are CPU-bound).
An actor could contain both type of inboxes (binary heap and array), so messages would go to one or another depending if there is an assigned priority or not. The actor would first process all messages from the heap inbox before jumping to array inbox. Also, replying to a prioritized message should inherit the priority (in case the recipient is also an actor).
Sending a message with priority could be as simple as:
// higher priority
actor.withPriority(0).tell("hello");
// lower priority
actor.withPriority(1).tell("hello");