apolloapollo-federationapollo-gateway

Mutation between two microservices on Apollo Federation


I'm using Apollo Federation to handle a lot of GraphQL microservices. I want to create a Notificaction when a user was followed so I need to send a mutation from UserService to NotificationService. How can I achieve this?

Thank you in advance!


Solution

  • I believe there's no way to make mutation work across multiples microservices. The only thing i can think of, is to always resolve some field in response and create a resolver in Notification MS. But that sounds more like a hack than a architecture solution.

    This is especially done because apollo doesn't have any transaction system, which is not required in case of queries, but does require for mutations.

    You should stick to default message exchange between microserivces, either an event bus (like kafka, or rabbitmq) or simple http api.