Is there any way to stop a service being moved between nodes in Service Fabric?
I have a stateless service that connects to an api to collect data
This API only permits 1 login at a time.
If Service Fabric constantly moves between nodes there are 2 potential issues -
1) I can walk into concurrent login issues
2) Assuming I can figure out when 1 service is being shut down and another is being started up, there will be a gap of x seconds whilst the service on the new node logs in. I need constant connection to the api
Once the service is started on a node, I want it to stay put!
Paul
The stateless service by default does not 'move' between nodes. Instead, each node will contain one running instance of that service. Requests are distributed to particular node instances in accordance with Round-robin algorithm.
If you want to connect to a specific instance of a stateless service please see this Q&A.
You could limit the number of instances of the stateless service to 1 (The default is -1 which means it will be running on each node in the cluster). But do mind that this will drastically limit scalability and reliability, probably the one reason you are using Service Fabric anyway.
You can set the instance count of a service using the ApplicationManifest.xml (see the docs for an example. or using PowerShell or code