Merge pull request #17633 from 2m/wip-buffer-drop-new

dropNew overflow strategy
This commit is contained in:
drewhk 2015-06-02 12:22:58 +02:00
commit 0e6694a102
8 changed files with 64 additions and 2 deletions

View file

@ -68,6 +68,10 @@ class StreamBuffersRateSpec extends AkkaSpec {
jobs.buffer(1000, OverflowStrategy.dropTail)
//#explicit-buffers-droptail
//#explicit-buffers-dropnew
jobs.buffer(1000, OverflowStrategy.dropNew)
//#explicit-buffers-dropnew
//#explicit-buffers-drophead
jobs.buffer(1000, OverflowStrategy.dropHead)
//#explicit-buffers-drophead

View file

@ -107,6 +107,11 @@ we want to be nice to jobs that has been waiting for long, then this option can
.. includecode:: code/docs/stream/StreamBuffersRateSpec.scala#explicit-buffers-droptail
Instead of dropping the youngest element from the tail of the buffer a new element can be dropped without
enqueueing it to the buffer at all.
.. includecode:: code/docs/stream/StreamBuffersRateSpec.scala#explicit-buffers-dropnew
Here is another example with a queue of 1000 jobs, but it makes space for the new element by
dropping one element from the *head* of the buffer. This is the *oldest*
waiting job. This is the preferred strategy if jobs are expected to be