TMSChangeNotification and subscription timeout message
TMSChangeNotification and subscription timeout message
In my project I'm using TMSChangeNotification component to reflect changes in my SQL tables. In some situations (eg. app error), SQLBroker queues are orphanded, hanging on server. Then, after next run of application, message "The subscription timeout expired" is displayed. How to avoid/hide/handle this message?
-
AndreyZ
Re: TMSChangeNotification and subscription timeout message
Hello,
For each notification that is sent by SQL Server, the TMSChangeNotification.OnChange event is called. But, SDAC does not show any messages about notifications. Please make sure that you do not show them in the TMSChangeNotification.OnChange event handler.
For each notification that is sent by SQL Server, the TMSChangeNotification.OnChange event is called. But, SDAC does not show any messages about notifications. Please make sure that you do not show them in the TMSChangeNotification.OnChange event handler.
Re: TMSChangeNotification and subscription timeout message
OnChange event handler is null in this project.
In this case it may be message forced by sqlNativeClient library (?) so maybe there is any way to handle it, eg by making some tweaks in SDAC Library sources?
In this case it may be message forced by sqlNativeClient library (?) so maybe there is any way to handle it, eg by making some tweaks in SDAC Library sources?
-
AndreyZ
Re: TMSChangeNotification and subscription timeout message
Please specify the exact version of SQL Server server and client. You can learn it from the Info sheet of TMSConnection Editor.
Re: TMSChangeNotification and subscription timeout message
SQL Server version: 10.50.1600
NativeClient: 10.52.4000.0
NativeClient: 10.52.4000.0
-
AndreyZ
Re: TMSChangeNotification and subscription timeout message
I cannot reproduce the problem. Please try creating a small sample to demonstrate the problem and send it to andreyz*devart*com .
Re: TMSChangeNotification and subscription timeout message
OK, message sent.
-
AndreyZ
Re: TMSChangeNotification and subscription timeout message
I have reproduced the problem. It occurs if the TMSQuery.Options.ReflectChangeNotify property is set to True. It means that TMSQuery will refresh itself on receiving notifications about data modifications. In this case, exceptions that may occur are handled by the Application.HandleException method. If you want to catch such exceptions, you should create your own exception handler method and set Application.OnException to it. Here is a code example:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnException := MyOnException;
end;
procedure TForm1.MyOnException(Sender: TObject; E: Exception);
begin
// your code that handles exceptions
end;Re: TMSChangeNotification and subscription timeout message
Thank you very much. This is the best solution and resolves the problem, especially when combined with TMSNotification.OnChange event handler.
-
AndreyZ
Re: TMSChangeNotification and subscription timeout message
I am glad I could help. If any other questions come up, please do not hesitate to contact us.