Skip to content

Reactor - Flux and Mono can't get them to work at all #692

@ianmichell

Description

@ianmichell

So I've been hammering away at this for a day and I can't seem to get even basic queries to work with mono or flux.

Below is an example of a query to a user profile from the identity store. If I convert this into a future it works out of the box, but the moment I use a mono i get all my fields as null

{"data":{"currentUserProfile":{"firstname":null,"lastname":null,"username":null,"emailAddress":null}}}

And the query code:

@PreAuthorize("isAuthenticated()")
    fun currentUserProfile(context: GraphQLSecurityContext): Mono<UserProfile> {
        return context.securityContext.flatMap { sc ->
            val details = sc.authentication.details as UserCredential
            userIdentityService.findById(details.id).map { UserProfile.fromUserIdentity(it) }
        }

I don't seem to have a problem generating schema with mono. I have registered a monad hook, but it seems to do nothing.

Is there something I'm doing wrong? I know it does call the query method, but I can't seem to figure out I get a null response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions