0

I have a Service Fabric Application which consists of two services. Both are stateless services and have a single instance of the services.

In Service A, I would like to define a Endpoint in the Resources section of the ServiceManifest.xml. I don't care what port I get, I just need one and I'd like to get it from Service Fabric so it can ensure it's accessible between the vms managed by the Service Fabric cluster.

In Service B, I'd like to pass the port created for Service A so it can use it to interact with the Service A. I will be defining both services with Service Fabric DNS names, so Service B will know the host of Service A (regardless of where it's running). But Service B also needs to the port that was created for Service A (via it's Endpoint declaration). Is that information passed to the Services? Can it be passed as a parameter, or is there another mechanism.

Thanks for any help

EdH
  • 4,918
  • 4
  • 24
  • 34

1 Answers1

0

You can discover information about the endpoints of the other service by using the QueryManager on the FabricClient. Example here.

Out of curiosity, can't you use SF remoting for this?

LoekD
  • 11,402
  • 17
  • 27
  • So, I can use the FabricClient as part of ServiceB's setup / run command? Is there a guarantee that ServiceA will be complete before ServiceB? And the port won't change across deployments? I'm not sure SF Remoting will help. I am using SF to orchestrate running an application with embedded Akka nodes, and am trying to get them to find one another. I am hoping that the host's port can be passed to the other services, but these aren't exposed as services at the Manifest granularity – EdH Apr 08 '19 at 22:50
  • There's no guarantee that Service A or B runs while the other starts. There is a good chance that it'll become alive at a point in the close future. Port changes are caused by endpoint changes, which can be monitored using `fabricClient.ServiceManager.ServiceNotificationFilterMatched`. – LoekD Apr 09 '19 at 06:05