August 2018
Intermediate to advanced
372 pages
9h 29m
English
Back pressure is a mechanism that allows us to specify the required number of elements to be read at once. It is used when you're interested in chunks of data with a defined quantity of n elements. The data is delivered in chunks until the whole dataset is reached.
Suppose that you want chunks of data with three elements, from a Flux object with ten elements. In this case, you will retrieve the data four times, as shown in the following example:
@Testpublic void givenAFluxWith10Elements_WhenBackPressureAsksForChunksOf3Elements_ThenYouHave4Chunks()throws Exception { List<Integer> digitsArray = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 0); Flux<Integer> fluxWithDigits = Flux.fromIterable (digitsArray); fluxWithDigits.buffer(Read now
Unlock full access