Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change overflow-strategy onOverflow handling #203

merged 1 commit into from Aug 10, 2016


None yet
1 participant
Copy link

alexandru commented Aug 10, 2016

Changing the signature of the onOverflow function parameter given to DropNewAndSignal, DropOldAndSignal and ClearBufferAndSignal.

We have had a signature like this:

case class DropNewAndSignal[A](bufferSize: Int, onOverflow: Long => A)
  extends OverflowStrategy[A]

The onOverflow is a function that receives the number of elements that were dropped while the consumer gets busy. So the consumer can then be notified that it had dropped events and behave accordingly. However this isn't always helpful. There are cases where we don't want to send any such message to the consumer, but we just want to log this information somewhere. We can do this currently, but it is way too hard and wasteful (e.g. boxing stuff in Either and filtering), so we are changing that signature to this:

case class DropNewAndSignal[A](bufferSize: Int, onOverflow: Long => Option[A])
  extends OverflowStrategy[A]

Thus, you can return Some(a) in case you want to inform the downstream subscribers of the overflow, or you can return a None, in which case no message gets sent. So you can just return None and log stuff.

@alexandru alexandru added this to the 2.0 milestone Aug 10, 2016

@alexandru alexandru self-assigned this Aug 10, 2016

@alexandru alexandru merged commit 9ec4368 into master Aug 10, 2016

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
continuous-integration/travis-ci/push The Travis CI build is in progress

@alexandru alexandru deleted the overflow-strategy branch Nov 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.