Francis Anyuru
Francis Anyuru

Reputation: 21

Spring Graphql Client code executing a query to receive a flux

Anyone know who to use the Spring graphql Client to receive a Flux of objects ? https://docs.spring.io/spring-graphql/docs/current/reference/html/#client.httpgraphqlclient What expression would you code for the client to execute a query to receive a flux of objects

Trying to solve a problem and expecting an answer

Upvotes: 0

Views: 268

Answers (1)

Francis Anyuru
Francis Anyuru

Reputation: 21

Build a normal reactive springboot app with the reactive database driver. Then configure the domain/entity record/class and connect it to the reactive repository and Configure your Controllers normally only change some directives to map to your graphql Schema

@MutationMapping
    public Mono<MemberBasic> addMember(@Argument MemberBasicInput memberBasicInput) {
        MemberBasic memberBasic = new MemberBasic(null, memberBasicInput.firstName(), memberBasicInput.lastName(),
                memberBasicInput.description(), memberBasicInput.gender(), memberBasicInput.dob());
        return this.memberRepository.save(memberBasic);

    }

as shown in the example above. https://spring.io/guides/gs/graphql-server

https://docs.spring.io/spring-boot/reference/web/reactive.html are great guides.

https://github.com/anyuruf/geneology/ example implementation though I couldn't find the graphql.schema for some reason. Let me know if you stuck

Upvotes: 0

Related Questions