Event Queues are also known as Mailboxes, especially when different events
have separate queues (this can also be implemented using a message queue with
Topics—with a topic for each Mailbox
).
Decouple a message or event from where it is sent away from when it is processed.
A data structure that receives events to be executed and allows other executors to receive and process these events.
Consider using an event queue when you want to decouple events in time.
A queue stores a series of notifications or requests in order based on priority—in a normal queue, a queue acts as a First In First Out data structure (although the queue could be a priority queue and bubble up events with higher priority). Receiving a notification or data results in an event being enqueued into the queue. The request processor then processes events at a later time. Requests can be handled directly, or routed to interested parties. This decouples the receiver and the data processing both statically and in time.
A simple event queue can be implemented using an array.
Observer Pattern