简体   繁体   中英

Spring WebFlux reactive input

What is the difference between a controller that gets input regular java payload and that of reactive payload. For example Say I have the following 2 end point

@RestController
public class MyController {
@PostMapping
public Flux<SomeObject> doThing(@RequestBody MyPayload playlod) {
// do things that return flux - reactive all the way from this controller

and this one

    @RestController
    public class MyController {
   @PostMapping
   public Flux<SomeObject> doThing(@RequestBody Mono<MyPayload> playlod) {
   

I don't understand the difference between the 2 method in reactive point of view

According to WebFlux documentation :

The request body can be one of the following way and it will be decoded automatically in both the annotation and the functional programming models:

  • Account account — the account is deserialized without blocking before the controller is invoked.
  • Mono<Account> account — the controller can use the Mono to declare logic to be executed after the account is deserialized.
  • Flux<Account> accounts — input streaming scenario.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM