I have a simple application that simulates an standalone application starting up and shutting down. It simply logs into the server, starts the MessageCommunicationManager and then gets the MessageCommunication class from the manager. The app then, on input from the user just stops the MessageCommunicationManager, disposes of the MessageCommunication class and then logs out.
This all works fine but I have noticed that it takes @9 seconds for the MessageCommunicationManager.Stop method to return.
I have tried leaving this step out but then it takes the sae amount of time to dispose of the MessageCommunication class.
I have also tried leaving this step out and then it takes the same amount of time to logout.
My question are,
Am I doing anything wrong or is there anything else that I should do in order to reduce the time it takes to shutdown the application
Is it really necessary to do these things when my application shuts down
Milestone Development tested the same the way, and it took only less than second (so 9 seconds for you might be too long). They assume that the Event Server might have issues on your site. Can you please check if there are any errors/exceptions logs in the event server log? Also, can you please tell us which version and edition of VMS are you using? Plus, please verify to use the newest SDK.
We tested following code sample with 2022 R2 server and 2022 R1 server. So far it has worked fine, and we could not reproduce the issue. I also checked logs and there are no errors/ exceptions there.
Can you please try the code on your servers that have the issue and see if you can see the issue?
public void start_click ()
{
_catchUpTimer = new Timer(CatchUpTimerHandler);
try
{
MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
_messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);
_systemConfigurationChangedIndicationRefefence = _messageCommunication.RegisterCommunicationFilter(SystemConfigChangedHandler2,
new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageId.System.SystemConfigurationChangedIndication));
}
catch (MIPException ex)
{
Trace.WriteLine("Message Communcation not supported:" + ex.Message);
}
}
public void Close_click()
{
_messageCommunication.UnRegisterCommunicationFilter(_systemConfigurationChangedIndicationRefefence);
MessageCommunicationManager.Stop(EnvironmentManager.Instance.MasterSite.ServerId);
}
I ran the sample and the MessageCommunicationManager.Stop method returned in @3 seconds. I then tried my test app again and got the same result. For clarity, I must add that I am accessing the system over a VPN connection. Whether this makes any difference or not I am not sure, can you shed any light?
Good point, CatchUpTimerHandler and SystemConfigChangedHandler2 are irrelevant, I just copied code from another sample and utilized it.
Regarding that you are accessing the system over a VPN connection, it could make sense. When I tested the code, I got results that is - stop method returned almost 2seconds. It could make sense, on the other hand, we are not experts of VPN and stuff so we can only assume so.