Azure Service Bus 连接能否在 Azure Service Fabric 节点改组后幸存下来?

Will Azure Service Bus connection survive Azure Service Fabric node shuffling?

我正在使用 Azure 服务总线 (ASB) 消息传递作为 Message-oriented middleware (MOM)。具体来说,主题和订阅作为 Pub-Sub 解决方案。

我在 Azure Service Fabric (ASF) 集群中使用 ASB。 ASF 集群管理可以洗牌节点,这将终止与 ASB 的连接。

我想知道优雅终止连接的正确方法是什么?

我正在考虑在集群中采用 Pub-Sub 解决方案。这将解决它和其他问题。

请检查此 link 以了解我为什么要保持连接: "Establishing a connection is an expensive operation that you can avoid by re-using the same factory and client objects for multiple operations. "

当服务 instance/replica 从一个节点移动到另一个节点时,连接将无法存活。您将需要实现一个 Service Fabric 通信侦听器,每次启动和停止服务 instance/replica 时都会调用该侦听器。

ASF cluster management can shuffle the nodes which will might kill the connections to ASB.

当 service fabric 在集群中移动服务时,它会终止进程并在其他节点中启动另一个服务实例,MessagingFactory 和每个进程的连接都是隔离的,即使您使用共享一个进程,您将不得不在新实例出现时重新创建这些连接。

For now, I can save the connection within the stateful service's reliable collection

我不知道你的意思,连接不像你存储在某处的一堆数据,它就像连接到主电源的电源线,连接或不连接。

Establishing a connection is an expensive operation that you can avoid by re-using the same factory and client objects for multiple operations.

我认为你误解了关于这个主题的想法。

在服务启动时打开连接并不昂贵,昂贵的是通过队列在每次迭代时打开和关闭连接。 如果您的服务经常在集群中移动,我认为连接时间将是您问题中最少的。

此规则适用于您不在迭代之间保持状态的情况,例如,如果您必须打开在每个请求上连接,这会减慢进程,在这种情况下适用此规则,因此您将保持 QueueSender 的一个实例并打开连接,因此每个连续的请求都会重用前一个连接。