How would you do the following with Kotlin, Spring WebFlux + Kotlin Coroutines in a reactive Way:
- Extract body (json) from ServerRequest.
- Load a (template) ClassPathResource (json) , do String replacements with values extracted from the request?
- Would a
Mono
be sufficient with a single map operation on the whole string?
- Under the assumption it’s not a
ClassPathResource
but some expensive DiskIO:
Would it make sense to Tokenize the File to a
Flux/Flow<String>
k
kenkyee
02/15/2020, 12:16 PM
Don't sound like you can parallelize anything, so a Mono should be fine.
That's more of a Reactor/reactive question than a webflux/coroutines thing.
You probably want to read the file on the ioscheduler and process it on the computation scheduler if it's a large file so possibly two functional Monos.