Inspectopedia Help

Calling 'subscribe' in "reactive" methods

Reports subscribe() calls in "reactive" methods.

Methods returning a Publisher type (including Flux and Mono) should not call the subscribe() method directly because it can break the reactive call chain.

Instead of using subscribe(), consider using composition operators like flatMap(), zip(), then(), and so on.

Example:

Flux<String> stringFlux(){ Flux<String> flux = Flux.just("abc"); flux.subscribe(); // <- blocking 'subscribe' call in non-blocking context return flux; }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Reactive Streams, 233.SNAPSHOT

Last modified: 13 July 2023