예제 #1
0
        public void LoadAll(Dictionary <string, string> idEplDictionary, bool exitOnFailure = false)
        {
            var logHelper = new LogHelper();

            logHelper.StartTimerFor("Rules insertion");
            foreach (var item in idEplDictionary)
            {
                try
                {
                    _eventProcessor.Load(item.Key, item.Value);
                    _log.Error($"Loaded rule id {item.Key}");
                }
                catch (ArgumentException)
                {
                    _log.Error($"Failed to load rule id {item.Key}");
                    if (exitOnFailure)
                    {
                        throw;
                    }
                }
            }
            logHelper.StopAndLogTime();
        }
예제 #2
0
        public bool Add(string id, string epl)
        {
            _log.Debug("Adding rule");

            return(_wcfCall.Wrap(() =>
            {
                if (string.IsNullOrEmpty(epl))
                {
                    throw new ArgumentNullException("epl");
                }
                if (string.IsNullOrEmpty(id))
                {
                    throw new ArgumentNullException("id");
                }

                var logHelper = new LogHelper();
                logHelper.LogRuleDetail(epl, id);

                _log.Debug(id + " > loading rule to NEsper");
                _adapter.Load(id, epl);

                return true;
            }));
        }