SCM

[#1011180] Detecting if listener disconnects?

View Trackers | Support Requests | Download .csv | Monitor

Date:
2012-03-29 19:06
Priority:
3
State:
Open
Submitted by:
Brandon Andrews (sirisian)
Assigned to:
Nobody (None)
Category:
Group:
Resolution:
None
 
Summary:
Detecting if listener disconnects?

Detailed description
I have software that listens to a database for table changes. Randomly it seems after running for a while or if the database is reset the listeners are removed, but my program is not notified at all. Is there a way to immediately detect the loss of connection so that I can rebind the listeners? This seems like a design flaw, but I'm not sure if there's a work around I haven't seen.

My basic code looks like this:
var command = new NpgsqlCommand("listen computerschanged;", connection);
command.ExecuteNonQuery();

connection.Notification += new NotificationEventHandler((o, e) =>
{
switch (e.Condition)
{
case "computerschanged":
// ...
break;
}
}

Followup

No Followups Have Been Posted

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge