I am using Azure Service Bus (ASB) Messaging as the Message-oriented middleware (MOM). Specifically, Topic and Subscriptions as a Pub-Sub solution.
I am using ASB within Azure Service Fabric (ASF) Cluster. ASF cluster management can shuffle the nodes which will kill the connections to ASB.
I wonder what will be the proper way to gracefully terminate the connections?
I am considering to have a Pub-Sub solution within the cluster down the road. That will solve it and other issues.
Please check this link to understand why I what to keep the connection alive: "Establishing a connection is an expensive operation that you can avoid by re-using the same factory and client objects for multiple operations. "
Connections will not survive when a service instance/replica is moved from one node to another. You will need to implement a Service Fabric communication listener that will be invoked every time a service instance/replica is started and stopped.