kovstas / fs2-throttler

Throttling for FS2 based on the Token bucket algorithm.

Version Matrix

FS2 Throttler

CI Status Maven Central

Throttling for FS2 based on the Token bucket algorithm.

This implementation supports:

  • burst in the processing of elements
  • calculating a cost for every element of the stream
  • two throttle modes (Shaping / Enforcing)

Install

libraryDependencies += "dev.kovstas" % "fs2-throttler" % Version

Usage

import dev.kovstas.fs2throttler.Throttler._

stream.through(throttle(1, 1.second, Shaping))

More examples you can find in tests.