Beispiel #1
0
        public override void Run()
        {
            // connects to AF
            AFDatabase afDatabase;
            var        afConnectionHelper = AfConnectionHelper.ConnectAndGetDatabase(Server, Database, out afDatabase);

            SearchEventFrames(afDatabase, SearchTime);
        }
Beispiel #2
0
        public override void Run()
        {
            // connects to AF
            AFDatabase afDatabase;
            var        afConnectionHelper = AfConnectionHelper.ConnectAndGetDatabase(Server, Database, out afDatabase);

            CreateEventFrame(afDatabase, EFName, StartTime, EndTime, Template);
        }
Beispiel #3
0
        private void MonitorAFAttributes()
        {
            DataPipeHandler afDataPipeHandler = null;

            try
            {
                //connect to AF Server
                if (string.IsNullOrEmpty(AFServerName))
                {
                    throw new AFServerNotFoundException();
                }

                else
                {
                    AFDatabase database;
                    var        _afConnectionManager = AfConnectionHelper.ConnectAndGetDatabase(AFServerName, AFDatabaseName,
                                                                                               out database);

                    // get the attributes that will be monitored
                    IDictionary <string, string> findAttributesErrors;
                    var attributes = AFAttribute.FindAttributesByPath(AttributesList, database, out findAttributesErrors);

                    // in case there was errors in the search we display them
                    if (findAttributesErrors != null && findAttributesErrors.Count > 0)
                    {
                        findAttributesErrors.ToList().ForEach(e => Logger.ErrorFormat("{0},{1}", e.Key, e.Value));
                    }


                    afDataPipeHandler = new DataPipeHandler(new AFConsoleDataObserver());
                    afDataPipeHandler.AddSignupsWithInitEvents(attributes);

                    afDataPipeHandler.StartListening(TimeSpan.FromSeconds(Interval));

                    Logger.InfoFormat("Listening for data changes started. Checking every {0}s", Interval);
                }
            }


            catch (Exception ex)
            {
                Logger.Error(ex);
            }

            finally
            {
                _terminateRequest.WaitOne();

                // null propagation operator, this is same as x!=null x.Dispose()
                afDataPipeHandler?.Dispose();
            }
        }