Bodytomono List of objects

I have a method that try use WebClient to return a Mono

@GetMapping["getMatch"] public Mono getMatch[@RequestParam Long matchId] { return WebClient.create[OpenDotaConstant.BASE_URL].get[] .uri["/matches/{matchId}", matchId] .accept[MediaType.APPLICATION_JSON] .retrieve[] .bodyToMono[Object.class]; }

It can return result that I expected. Then I try to create another method to support List as params

@GetMapping["getMatches"] public Flux getMatches[@RequestParam String matchesId] { List matchesList = JSON.parseArray[matchesId, Long.class]; return Flux.fromStream[matchesList.parallelStream[].map[this::getMatch]]; }

But this time return a weird result.

[ { "scanAvailable": true }, { "scanAvailable": true } ]

I'm new to reactive-programming, What is the correct way to combine Stream and Mono,and then convert to the Flux?

Video liên quan

Chủ Đề