API gateway/proxy pattern for microservices deployed using Azure Service Fabric

后端 未结 8 1812
遇见更好的自我
遇见更好的自我 2021-01-31 09:01

After watching the BUILD conference videos for Azure Service Fabric, I\'m left imagining how this might be a good fit for our current microservice-based architecture. There is o

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-31 09:19

    The service registration/discoverability you need to do this is actually already there. There's a stateful system service called the Naming Service, which is basically a registrar of service instances and the endpoints they're listening on. So when you start up a service - either stateless or stateful - and open some listener on it, the address gets registered with the Naming Service.

    Now the part you'd need to fill in is the "gateway" that users interact with. This doesn't have to be stateful because the Naming Service manages the stateful part. But you'd have to come up with an addressing scheme that works for you, and then it would just forward requests along to the right place. Basically something like this:

    1. Receive request.
    2. Use NS to find the service that can take the request.
    3. Forward the request to it and the response back to the user.
    4. If the service doesn't exist anymore, 404.

    In general we don't like to dictate anything about how your services talk to each other, but we are thinking of ways to solve this problem for HTTP as a complete built-in solution.

提交回复
热议问题