range() creates a Flux that emits a finite, consecutive sequence of integers. Give it a starting value and a count; Flux.range(1, 5) publishes 1 through 5 and then completes. section 11.3.1
@Test
public void createAFlux_range() {
Flux<Integer> intervalFlux =
Flux.range(1, 5);
StepVerifier.create(intervalFlux)
.expectNext(1)
.expectNext(2)
.expectNext(3)
.expectNext(4)
.expectNext(5)
.verifyComplete();
}
This test creates a range Flux, verifies each emitted integer with StepVerifier, and confirms completion. section 11.3.1
Use range() when a reactive pipeline needs counter-like data without an existing collection. Unlike interval(), it emits a bounded sequence immediately from explicit range parameters rather than repeatedly on a time duration. section 11.3.1







