我正在使用Akka.Remote在服務器端服務應用程序和多個桌面客戶端應用程序之間進行通信。客戶端向服務器發送請求消息(使用Akka.net)並等待服務器回覆響應消息。客戶端應用程序是暫時的,這意味着它們通常連接到服務器,保持連接一段時間,斷開連接並再次重新連接。Akka.Remote - 解開後無法將消息發送給遠程演員
我遇到的問題是,有時當客戶端從服務器角色斷開(通過關閉其ActorSystem
)然後重新連接回服務器時,它在一段時間內不會收到來自服務器的任何回覆。幾分鐘之後,通信工作沒有任何問題。我發現當服務器向客戶端發送了一個迴應,這個客戶端在請求期間斷開連接並且不再可達時就會發生這個問題。服務器無法傳遞響應消息,並以某種方式將客戶端端點標記爲無效。
在日誌中(在服務器端),當客戶端斷開連接時,我收到以下消息。
[DEBUG] 2016-01-21 13:04:58.6151 received AutoReceiveMessage <Terminated>: [akka.tcp://[email protected]:8090/user/qb] - ExistenceConfirmed=True ServerActor
[DEBUG] 2016-01-21 13:04:58.6550 Stopped Akka.Remote.Transport.ProtocolStateActor
[ INFO] 2016-01-21 13:04:58.6550 Quarantined address [akka.tcp://[email protected]:8090] is still unreachable or has not been restarted. Keeping it quarantined. Akka.Event.DummyClassForStringSources
[DEBUG] 2016-01-21 13:04:58.6725 Stopped Akka.Remote.ReliableDeliverySupervisor
[DEBUG] 2016-01-21 13:04:58.6725 no longer watched by [akka://myservice/system/endpointManager/reliableEndpointWriter-akka.tcp%3a%2f%2fqb%40client%3a8090-2] Akka.Remote.EndpointWriter
[DEBUG] 2016-01-21 13:04:58.6725 Disassociated [akka.tcp://[email protected]:8081] <- akka.tcp://[email protected]:8090 Akka.Remote.EndpointWriter
[DEBUG] 2016-01-21 13:04:58.6725 Stopped Akka.Remote.EndpointWriter
然後當客戶端嘗試重新連接時,我得到:
[DEBUG] 2016-01-21 13:05:15.5883 ConnectResponse [akka.tcp://[email protected]:8090/user/qb] ServerActor
[DEBUG] 2016-01-21 13:05:16.0467 Started (Akka.Remote.Transport.ProtocolStateActor) Akka.Remote.Transport.ProtocolStateActor
[DEBUG] 2016-01-21 13:05:16.0467 Stopped Akka.Remote.Transport.ProtocolStateActor
[ WARN] 2016-01-21 13:05:16.0467 AssociationError [akka.tcp://[email protected]:8081] -> akka.tcp://[email protected]:8090: Error [Invalid address: akka.tcp://[email protected]:8090] [] Akka.Remote.EndpointWriter
[ INFO] 2016-01-21 13:05:16.0467 Quarantined address [akka.tcp://[email protected]:8090] is still unreachable or has not been restarted. Keeping it quarantined. Akka.Event.DummyClassForStringSources
[DEBUG] 2016-01-21 13:05:16.0643 Stopped Akka.Remote.ReliableDeliverySupervisor
[DEBUG] 2016-01-21 13:05:16.0711 no longer watched by [akka://myservice/system/endpointManager/reliableEndpointWriter-akka.tcp%3a%2f%2fqb%40client%3a8090-4] Akka.Remote.EndpointWriter
[DEBUG] 2016-01-21 13:05:16.0711 Disassociated [akka.tcp://[email protected]:8081] -> akka.tcp://[email protected]:8090 Akka.Remote.EndpointWriter
[DEBUG] 2016-01-21 13:05:16.0711 Stopped Akka.Remote.EndpointWriter
[DEBUG] 2016-01-21 13:05:16.0867 received AutoReceiveMessage <Terminated>: [akka://myservice/system/endpointManager/reliableEndpointWriter-akka.tcp%3a%2f%2fqb%40client%3a8090-4] - ExistenceConfirmed=True Akka.Remote.EndpointManager
[DEBUG] 2016-01-21 13:05:16.0867 Terminated [akka.tcp://[email protected]:8090/user/qb] ServerActor
我懷疑這種行爲是Akka.net的功能,但是,我需要實現我的系統,使客戶可以斷開連接,然後重新連接回服務器而無需等待。有什麼辦法可以禁用隔離機制或正常關閉服務器上的客戶端端點,以便客戶端端點不會被隔離?
謝謝@Aaronontheweb。我是否需要重新啓動服務器端或客戶端的參與者系統?或兩者? –
您需要在連接的另一端重新啓動參與者系統 - 因此,如果服務器報告它隔離了客戶端,則需要重新啓動客戶端。 – Aaronontheweb