Subject RE: [IBO] TIB_Events and multithreading
Author IBO Support List
Dany,
 
The service app framework has a timeout feature. Inside of this you can call IB_Connection.VerifyConnection to make sure the inactivity isn't due to a lost connection. If it is in a state where the connection was lost you should go ahead and disconnect it and then attempt to reconnect it. If it fails, allow the service app to go back to sleep with the waiting flag set to true so that it will sleep for a shorter period of time. Your service app is now in the mode of establishing the connection again. It will wake up and try to establish a connection.
 
Jason


From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Sent: Monday, April 27, 2015 6:53 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] TIB_Events and multithreading

Hello!


I have a multithreaded server. It uses connection pooling. Actually there is a pool of pools, each with a different DataModule as base class for the pooled objects.


The server also listens to events. The listener TIB_Event is of course connected to a TIB_Connection (with it's own TIB_Session) component. When an event notification is received a new thread will be spawned where the cached data (depending on event) is updated.


If the connection(s) is(are) lost, then the pooled DataModules will eventually time out and when accessed anew will continue to work if the connection can be made again. This is quite ok as the clients will get an error.


The problem is the connection of the event component. If this connection is lost, i won't get any notifications from the database. Thus it seems i'll never get an "connection lost" error code. I tried to hook into the OnErrorEx of the event alerters connection but it will not trigger.


Any ideas for this problem. Anyone hacked around it and in that case how did you do it? The thing is that an event could be important even though the server does not need to access the database any other way for some time. This leaves me with a server that thinks it has the correct (up to date) info but has not. It will not get notified even.


A regular check on the connection being alive comes to mind. Is this safe to do?


Vague questionings, i know. Sorry about that.


BTW - FB 2.5.x, IBO 5.7.3 2238, XE7


TIA,


/Dany