Optimized http service invocation with in azure service fabric

不羁岁月 提交于 2019-12-12 03:39:10

问题


I have 2 applications (A1 and A2) hosted in azure service fabric, each application with its own stateless reliable micro-service (S1 and S2). The app A1 depends on S1 and app A2 depends on S2. In addition, S2 service depends on S1. Both S2 and S1 are owin hosted REST api services. When the request for A2 ends up in S2, I need to make a call from S2 to S1. I am trying to figure out the optimized way of doing this.

1) Should I use HttpClient in S2 to call S1? How do I get the resolution for S1 in side of S2? Is it just published uri for S1 and fabric will know how to optimize those calls? 2) Should I implement 2 listeners in S1 (one http endpoint for A1 clients and one service remoting endpoint with an interface to call from S2)? Again how does address resolution work?

In either case, short code samples would be of immense help.

Thanks. Raghu/..


回答1:


Yes S2 can use HttpClient to call S1. First S2 needs to resolve an address for S1. Service Fabric has APIs for that. Here's some documentation that gives you an overview of how this works:

https://azure.microsoft.com/en-us/documentation/articles/service-fabric-connect-and-communicate-with-services/

https://azure.microsoft.com/en-us/documentation/articles/service-fabric-reliable-services-communication/

And a simple sample application that has one service that resolves the address of a second service (it's resolving a stateful service but it works the same way for stateless)

https://github.com/Azure-Samples/service-fabric-dotnet-getting-started/tree/master/Services/WordCount/WordCount.WebService



来源:https://stackoverflow.com/questions/37617556/optimized-http-service-invocation-with-in-azure-service-fabric

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!