Page 1 of 1

TMSChangeNotification and subscription timeout message

Posted: Thu 24 Jan 2013 14:49
by Rnest
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?

Re: TMSChangeNotification and subscription timeout message

Posted: Fri 25 Jan 2013 11:40
by AndreyZ
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.

Re: TMSChangeNotification and subscription timeout message

Posted: Fri 25 Jan 2013 13:04
by Rnest
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?

Re: TMSChangeNotification and subscription timeout message

Posted: Mon 28 Jan 2013 14:38
by AndreyZ
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

Posted: Wed 30 Jan 2013 09:19
by Rnest
SQL Server version: 10.50.1600
NativeClient: 10.52.4000.0

Re: TMSChangeNotification and subscription timeout message

Posted: Wed 30 Jan 2013 13:29
by AndreyZ
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

Posted: Wed 30 Jan 2013 15:40
by Rnest
OK, message sent.

Re: TMSChangeNotification and subscription timeout message

Posted: Thu 31 Jan 2013 09:30
by AndreyZ
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

Posted: Thu 31 Jan 2013 13:29
by Rnest
Thank you very much. This is the best solution and resolves the problem, especially when combined with TMSNotification.OnChange event handler.

Re: TMSChangeNotification and subscription timeout message

Posted: Fri 01 Feb 2013 08:00
by AndreyZ
I am glad I could help. If any other questions come up, please do not hesitate to contact us.