Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

microservices - Retry logic implementation on graphql server

I am building micro services using graphQl. I have build a gateway which calls all service. I need to implement retry logic in it. I am writing the following code...

const gateway = new ApolloGateway({
  serviceList: [
    { name: "task service", url: "http://localhost:8001/graphql" },
    { name: "resource service", url: "http://localhost:8002/graphql" }
],
__exposeQueryPlanExperimental: false,
});

const apolloServer = new ApolloServer({
  gateway,
  subscriptions: false,
  context: async () => {
    new RetryLink({
      delay: {
        initial: 7000,
        max: Infinity,
        jitter: true
      },
      attempts: {
        max: 5,
        retryIf: (error, _operation) => !!error
      }
    });
}
});

But it does not work. Can anyone help us how we can implement retry logic in it. Although it is working on client side with react.
question from:https://stackoverflow.com/questions/66059447/retry-logic-implementation-on-graphql-server

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...