我已经用.NET 4编写了一个使用FirebirdSql.Data.FirebirdClient ADO.NET provider v4.5.2.0的windows服务。
该服务依赖于捕获firebird Db发布的事件来执行其任务。
我用来订阅相关事件的代码是:
<!-- language: lang-cs -->
public void SetFirebirdEventListeners()
{
string[] fbEvents = new string[] { "QueueUpdate", "DispensedSupplyUpdate", "QueueInsert", "DispensedSupplyInsert" };
try
{
fbRemoteEvent = new FbRemoteEvent(fbConn);
fbRemoteEvent.AddEvents(fbEvents);
// Add callback to the Firebird events
fbRemoteEvent.RemoteEventCounts += new FbRemoteEventEventHandler(FbEventHandler);
// Queue events
fbRemoteEvent.QueueEvents();
WriteEventToLog();
}
catch (Exception ex)
{
log.Error("Error setting firebird event listeners. {0}Message:{1}Stacktrace:{2}", Environment.NewLine + Environment.NewLine, ex.Message + Environment.NewLine, ex.StackTrace);
throw;
}
}只要服务正在运行,到firebird的连接就会保持打开。
这在一段时间内(通常是几个小时)工作得很好,但是看起来似乎是随机的,服务只是停止接收事件。不会抛出异常。
有没有人在Firebird中遇到过这个问题并找到了原因?我在文档中看不到任何东西。有没有办法收到服务不再订阅事件的警告?
发布于 2017-09-24 00:05:08
在Firebird注册和通知事件的方式中,您可能会遇到竞争条件。此错误将在Firebird 2.5.8和Firebird 3.0.3中修复。详情请参见CORE-5521。
https://stackoverflow.com/questions/26985987
复制相似问题