Skip to content

Instantly share code, notes, and snippets.

@khajavi
Created March 19, 2019 17:50
Show Gist options
  • Save khajavi/b1d74b476eb2f1e80f9629e809098597 to your computer and use it in GitHub Desktop.
Save khajavi/b1d74b476eb2f1e80f9629e809098597 to your computer and use it in GitHub Desktop.
/**
* Represents a mode that decides how to deal exceed rate for Throttle operator
*/
sealed abstract class ThrottleMode
object ThrottleMode {
/**
* Tells throttle to make pauses before emitting messages to meet throttle rate
*/
case object Shaping extends ThrottleMode
/**
* Makes throttle fail with exception when upstream is faster than throttle rate
*/
case object Enforcing extends ThrottleMode
/**
* Java API: Tells throttle to make pauses before emitting messages to meet throttle rate
*/
def shaping = Shaping
/**
* Java API: Makes throttle fail with exception when upstream is faster than throttle rate
*/
def enforcing = Enforcing
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment