Hello Evgeny,
Thank you for replying. The solution you mentioned does work for any other service using Olympia. I did something very similar thanks to your suggestions and looking at your code, but when trying to re-establish Olympia’s event sinks themselves, it fails.
What I did was, I put some code on the OnConnected/OnDisconnected event of the channel use to connect to the Olympia and hold by any instance of the TROOlympia session manager.
When OnDisconnected I mark if it is the first activation or not (to avoid loops). On the OnConnected, if it is not the first activation it means we are recovering from some issue with Olympia and then I attempt to re-register Olympia events so this Olympia client can continue to receive messages.
if fIsDisconnected then
begin
fLogger.Info('Reconnecting to Olympia.');
if fSessionManager.IsSessionPresent(fRemoteServiceConnection.ClientId) then
begin
if Supports(fRemoteServiceConnection.Channel, IROActiveEventServer, lActive) then
begin
fEventRepository.AddSession(fRemoteServiceConnection.ClientId, lActive, 'OlympiaEvents');
fEventRepository.AddSession(fRemoteServiceConnection.ClientId, lActive, 'OlympiaSessionManagerEvents');
end
else
begin
fEventRepository.AddSession(fRemoteServiceConnection.ClientId, 'OlympiaEvents');
fEventRepository.AddSession(fRemoteServiceConnection.ClientId, 'OlympiaSessionManagerEvents');
end;
end else
fLogger.Error('Session not found. Could not reconnect.');
I’ll get timeouts on any attempt to contact olympia. I also tried to simply activate, deactivate the session and event repository components which hold all the registration code, but it will fail with timeouts. Something on the client needs to be completely recreated in order to re-establish a connection and a proper registration to an Olympia instance, which is strange cause other services will restore just fine without having to go to those lengths.
Any tips? The issue is quite simple to reproduce, just open olympia, connect a client that uses it, shutdown olympia, turn it back on and do something to try to re-establish olympias connectivity to that client (previous state). If you can tell me what to do to achieve that result while i wait for the future improvements it will be great.
Note: The fRemoteServiceConnection is just and Interfaced wrapper to hold the clientId and other properties on a single place, the underlying is just a simple Channel/Message. On this ocassion, fRemoteServiceConnection.Channel will be the same channel as what SessionManager has assigned. The code can be simply replace to be SessionManager.ClientID for understanding purposes.