Home > Mobile >  Zip mono/flux with another that depends on the one I own
Zip mono/flux with another that depends on the one I own

Time:04-04

I want to zip two monos/fluxes, but the second one (the one I'll zip) is dependand from the first that I already own.
For example:

//...

    fun addGroup(
        input: GroupInput
    ): Mono<Group> = Mono.just(Group(title = input.title, description = input.description))
        .flatMap { g -> groupsRepository.save(g) } // Gives me back the new db ID
        .zipWith(Mono.just(GroupMember(g.id /* <-- ??*/, input.ownerId, true)))
        //...

// ...

Is it possible?

CodePudding user response:

I would say no. You can only zip things that can run in parallel.

CodePudding user response:

you could use map or flatmap in this case, is there any reason you need to use Zip?

  • Related