rxjava2 producer-consumer example with backpressure implementation

This post is a small example how to implement a producer and consumer using rxjava2. The producer produces a sequence of Integer objects which are consumed by the consumer. The producer only produces as much items as are requested by the reactive stream. The reader of this post should be familiar with the reactive streams concept. project setup I used a maven project, the only dependency needed for this example besides logging is rxjava: