Skip to content

Pattern 3: Queues

pewsou edited this page Feb 25, 2023 · 1 revision

Intro

The idea of queues is trivial - push something from one side, pull from another. Here queues follow this pattern, but with different flavors.

Simple/Basic queue.

Provides expected functionality but also can have blocking mode; in this case it can block on writing until someone attempts to read; or the reader may wait on empty queue until someone writes data. Also queue size management is available - one can set lower/upper limits and then reading will be impossible until minimum quantity of items is written; or writing will be impossible if the size is at upper limit.

Filtering Queue.

similar to Basic Queue (blocking mode is not supported, thou); allows to filter data according to some criterium; has upper/lower limits; has dropping policies for size management - one may want to control the manner of keeping the queue between limits; for example, when writing into full queue, the new item may be rejected, or some other item may be thrown out to make place.

Batching queue.

Special queue that organizes items into batches (groups). For example, writing the whole array into queue will form 1 batch with contents of this array. Can also be blocking, per batch.

Clone this wiki locally