Split example to ease into the details. PR Comments
This commit is contained in:
parent
506cbc5bf4
commit
6eb1a9e1ef
3 changed files with 45 additions and 12 deletions
|
|
@ -31,10 +31,18 @@ public class Throttle {
|
|||
|
||||
Source<Frame, NotUsed> videoThrottling =
|
||||
frameSource.throttle(
|
||||
framesPerSecond, Duration.ofSeconds(1), framesPerSecond * 30, ThrottleMode.shaping());
|
||||
framesPerSecond, Duration.ofSeconds(1));
|
||||
// serialize `Frame` and send over the network.
|
||||
// #throttle
|
||||
|
||||
// #throttle-with-burst
|
||||
Source<Frame, NotUsed> throttlingWithBurst =
|
||||
frameSource.throttle(
|
||||
framesPerSecond, Duration.ofSeconds(1), framesPerSecond * 30, ThrottleMode.shaping());
|
||||
// serialize `Frame` and send over the network.
|
||||
// #throttle-with-burst
|
||||
|
||||
videoThrottling.map(f -> f.i()).to(Sink.foreach(System.out::println)).run(mat);
|
||||
throttlingWithBurst.take(1000L).map(f -> f.i()).to(Sink.foreach(System.out::println)).run(mat);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue