public void Start() { Logger.LogDebug("Starting..."); OnStart(); Logger.LogInfo("Started."); // - subscribe to ProviderRuleSet updates RuleSet = Client.CreateCache(delegate(CacheChangeData update) { try { if (update.Change == CacheChange.ItemCreated || update.Change == CacheChange.ItemUpdated) { var mapRuleSet = (ProviderRuleSet)update.NewItem.Data; if (mapRuleSet.provider == ProviderId) { _marketDataMap.ImportRules(mapRuleSet); Logger.LogDebug("Processed new rule set: {0}", update.NewItem.Name); } } } catch (Exception e) { Logger.Log(e); } }, null); RuleSet.Subscribe <ProviderRuleSet>(Expr.ALL); }
protected override void OnFirstCallback() { _WorkerResponseCache = _IntClient.Target.CreateCache(); _WorkerResponseCache.Subscribe <WorkerResponse>( Expr.BoolAND( Expr.IsEQU(RequestBase.Prop.WorkerHostComputer, Environment.MachineName), (HostInstance == null) ? Expr.IsNull(RequestBase.Prop.WorkerHostInstance) : Expr.IsEQU(RequestBase.Prop.WorkerHostInstance, HostInstance)), (subs, item) => { _EventQueue.Dispatch(null); }, null); _CancellationsCache = _IntClient.Target.CreateCache(); _CancellationsCache.Subscribe <CancellationRequest>(Expr.ALL, (subs, item) => { _EventQueue.Dispatch(null); }, null); _AssignedRequestsCache = _IntClient.Target.CreateCache(); _AssignedRequestsCache.Subscribe <AssignedWorkflowRequest>( Expr.BoolAND( Expr.IsEQU(RequestBase.Prop.WorkerHostComputer, Environment.MachineName), (HostInstance == null) ? Expr.IsNull(RequestBase.Prop.WorkerHostInstance) : Expr.IsEQU(RequestBase.Prop.WorkerHostInstance, HostInstance)), (subs, item) => { _EventQueue.Dispatch(null); }, null); _HousekeepTimer = new Timer(HousekeepTimeout, null, HousekeepInterval, HousekeepInterval); _EventQueue.Dispatch(null); }
protected override void OnFirstCallback() { _ManagerResponseCache = _IntClient.Target.CreateCache(); _ManagerResponseCache.Subscribe <ManagerResponse>(Expr.ALL, (subs, item) => { _EventQueue.Dispatch(null); }, null); _CancellationsCache = _IntClient.Target.CreateCache(); _CancellationsCache.Subscribe <CancellationRequest>(Expr.ALL, (subs, item) => { _EventQueue.Dispatch(null); }, null); _UnassignedRequestsCache = _IntClient.Target.CreateCache(); _UnassignedRequestsCache.Subscribe <UnassignedWorkflowRequest>(Expr.ALL, (subs, item) => { _EventQueue.Dispatch(null); }, null); _WorkerAvailabilityCache = _IntClient.Target.CreateCache(); _WorkerAvailabilityCache.Subscribe <WorkerAvailability>(Expr.ALL, (subs, item) => { _EventQueue.Dispatch(null); }, null); _HousekeepTimer = new Timer(HousekeepTimeout, null, HousekeepInterval, HousekeepInterval); _EventQueue.Dispatch(null); }
protected override void OnFirstCallback() { // subscribe to import rules _ruleCache = IntClient.Target.CreateCache(delegate(CacheChangeData update) { Interlocked.Increment(ref _dispatchedEventCount); MainThreadQueue.Dispatch(update, ProcessRuleUpdate); }, null); _ruleCache.Subscribe <AlertRule>( RuleObject.MakeRuleFilter( EnvHelper.EnvName(IntClient.Target.ClientInfo.ConfigEnv), IntClient.Target.ClientInfo.HostName, AppName, IntClient.Target.ClientInfo.UserName)); // start a 30 second timer to periodically check the rules _timer = new Timer(RecvTimerEvent, null, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30)); }
protected override void OnFirstCallback() { // subscribe to import rules _importRuleSet = IntClient.Target.CreateCache(delegate(CacheChangeData update) { Interlocked.Increment(ref _updateRequestsDispatched); MainThreadQueue.Dispatch(update, ProcessRuleUpdate); }, null); _importRuleSet.Subscribe <FileImportRule>( RuleObject.MakeRuleFilter( EnvHelper.EnvName(IntClient.Target.ClientInfo.ConfigEnv), IntClient.Target.ClientInfo.HostName, AppName, IntClient.Target.ClientInfo.UserName)); // start a 1 minute timer to periodically check the rules _timer = new Timer(RecvTimerEvent, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); }