protected BaseWoopsaSubscriptionServiceSubscription(
WoopsaSubscriptionChannel channel,
WoopsaContainer root,
int subscriptionId, string propertyPath,
TimeSpan monitorInterval, TimeSpan publishInterval)
{
Channel = channel;
Root = root;
SubscriptionId = subscriptionId;
MonitorInterval = monitorInterval;
PublishInterval = publishInterval;
PropertyPath = propertyPath;
_lock = new object();
_notifications = new List<IWoopsaNotification>();
if (monitorInterval == WoopsaSubscriptionServiceConst.MonitorIntervalLastPublishedValueOnly &&
publishInterval == WoopsaSubscriptionServiceConst.PublishIntervalOnce)
DoPublish();
else if (publishInterval > TimeSpan.FromMilliseconds(0))
{
_publishTimer = channel.ServiceImplementation.TimerScheduler.AllocateTimer(publishInterval);
_publishTimer.Elapsed += _publishTimer_Elapsed;
_publishTimer.IsEnabled = true;
}
else
throw new WoopsaException("A publish interval of 0 with a non-zero monitor interval is not allowed");
}