2

I am using RxJava 2 Flowable with DROP BackPressure strategy. Is there any way to collect information / stats about how many messages are actually dropped because of the BackPressure?

Solution

Flowable#onBackpressureDrop(consumer -> {}); http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html#onBackpressureDrop(io.reactivex.functions.Consumer)

Thomas
  • 1,053
  • 2
  • 11
  • 20
  • 2
    There is an overload that takes an onDrop handler you can use for counting. – akarnokd Jan 16 '17 at 09:08
  • Indeed, thanks @akarnokd ! http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html#onBackpressureDrop(io.reactivex.functions.Consumer) – Thomas Jan 16 '17 at 11:38

1 Answers1

2

There is an overload that takes an onDrop handler you can use for counting.

Generally, it is advised to check an operator's overloads for additional features.

akarnokd
  • 69,132
  • 14
  • 157
  • 192
  • Thanks. There's also a method on the Flowable: http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html#onBackpressureDrop(io.reactivex.functions.Consumer) – Thomas Jan 18 '17 at 08:54