Пример #1
0
        public RuleService(
            IOptions <RuleOptions> ruleOptions,
            IEnumerable <IRuleTriggerHandler> ruleTriggerHandlers,
            IEnumerable <IRuleActionHandler> ruleActionHandlers,
            IEventEnricher eventEnricher,
            IJsonSerializer jsonSerializer,
            IClock clock,
            ISemanticLog log,
            TypeNameRegistry typeNameRegistry)
        {
            Guard.NotNull(jsonSerializer, nameof(jsonSerializer));
            Guard.NotNull(ruleOptions, nameof(ruleOptions));
            Guard.NotNull(ruleTriggerHandlers, nameof(ruleTriggerHandlers));
            Guard.NotNull(ruleActionHandlers, nameof(ruleActionHandlers));
            Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry));
            Guard.NotNull(eventEnricher, nameof(eventEnricher));
            Guard.NotNull(clock, nameof(clock));
            Guard.NotNull(log, nameof(log));

            this.typeNameRegistry = typeNameRegistry;

            this.ruleOptions         = ruleOptions.Value;
            this.ruleTriggerHandlers = ruleTriggerHandlers.ToDictionary(x => x.TriggerType);
            this.ruleActionHandlers  = ruleActionHandlers.ToDictionary(x => x.ActionType);
            this.eventEnricher       = eventEnricher;

            this.jsonSerializer = jsonSerializer;

            this.clock = clock;

            this.log = log;
        }
Пример #2
0
        public RuleService(
            IOptions <RuleOptions> ruleOptions,
            IEnumerable <IRuleTriggerHandler> ruleTriggerHandlers,
            IEnumerable <IRuleActionHandler> ruleActionHandlers,
            IEventEnricher eventEnricher,
            IJsonSerializer jsonSerializer,
            IClock clock,
            ILogger <RuleService> log,
            TypeNameRegistry typeNameRegistry)
        {
            this.typeNameRegistry = typeNameRegistry;

            this.ruleOptions         = ruleOptions.Value;
            this.ruleTriggerHandlers = ruleTriggerHandlers.ToDictionary(x => x.TriggerType);
            this.ruleActionHandlers  = ruleActionHandlers.ToDictionary(x => x.ActionType);
            this.eventEnricher       = eventEnricher;

            this.jsonSerializer = jsonSerializer;

            this.clock = clock;

            this.log = log;
        }