Profile Picture

ServiceEvent not in build 36 HistoricalDataRetrieval Samples

Posted By alpha23 6 Years Ago

ServiceEvent not in build 36 HistoricalDataRetrieval Samples

Message
Posted Wednesday June 22 2011
In build 36, HistoricalDataRetrieval implements IService; however, ServiceEvent is not implemented in the Samples\C#\HistoricalDataRetrieval. I added the following line so that it will build but unsure if there isn't more to the intended implementation:

public event EventHandler<ServiceEventArgs> ServiceEvent;

Please advise.

Thanks, Duane
Posted Thursday June 23 2011
That's all you need in this case. The event lets the plugin notify RightEdge when it has been disconnected or reconnected, but that only really applies to live data or broker plugins. A historical data service can just throw an exception if it gets disconnected while retrieving data.

Thanks,
Daniel
Posted Saturday December 31 2011
dplaisted (6/23/2011)
That's all you need in this case. The event lets the plugin notify RightEdge when it has been disconnected or reconnected, but that only really applies to live data or broker plugins. A historical data service can just throw an exception if it gets disconnected while retrieving data.

Thanks,
Daniel


I'm currently working on a SQL server data retrieval plugin (that I will eventually extend with ITickDataRetrieval) and would like to have this functionality (do something if the SqlConnection is lost).

The problem is I don't believe there is a way to know if an SQL server connection has been lost. I see the way it's handled in the TWSPlugin is the client.Error event raises ServiceEvent when appropriate. But what event will raise ServiceEvent in my case? The StateChanged event of an SqlConnection object is only fired when you explicitly call Close() or Dispose(), it won't raise if the "cable is unplugged". This after all makes sense since a server cannot tell you when it is down otherwise there would be no need for pinging.

How can I work around this? Id like for RightEdge to automatically attempt to reconnect to the server every few seconds following the connection loss, but without the ServiceEvent firing RightEdge won't know that it should be attempting to reconnect, is this correct or not?

Additionally, once the reconnect succeeds and IService.Connect() returns true I would also want it to "catch up" on the ticks it missed while disconnected from the server. Is this behavior already implemented in ITickDataRetrieval or will I have to handle this separately once the connection is restored?



Edited: Saturday December 31 2011 by parliament718


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems