« Back to all Examples

ReactiveBufferExample

Frank Alexander Kraemer

NTNU - Department of Telematics

In the example, the producer is realized by a periodic timer and a counter, and produces five objects with a period of 1000 milliseconds. The consumer, on the other hand, consumes the objects. However, the consumer does this much slower, here simulated by a timer with a duration of 5000 milliseconds. The buffer between them stores the objects, so that both processes can work in their respective speed. Whenever the consumer is ready to take another object, it notifies the buffer via next. If there are further objects in the buffer, it receives the next one. Otherwise, the buffer will receive the next object when the producer has added the next one. The switcher in the example is just used to terminated properly.

ReactiveBufferExample
Import Example via SVN
Drop this link into the Arctis View