public WorkaroundWorker(ILogger <WorkaroundPublisherService> log, WorkaroundDefinition definition)
        {
            _log        = log;
            _definition = definition;

            _log.LogDebug("initialize");

            var options = new JsonSerializerOptions
            {
                WriteIndented = true,
            };

            _log.LogDebug("settings {settings}", JsonSerializer.Serialize(_definition, options));

            foreach (var inst in _definition.events)
            {
                //match everything until first parameter (indicated by { ) or until the end
                var key = Regex.Match(inst, @"^([^{])+").ToString();

                if (_eventFactory.KnowsType(key))
                {
                    if (events == null)
                    {
                        events = new List <IWorkaroundEvent>();
                    }

                    IWorkaroundEvent temp = _eventFactory.Create(key);

                    if (temp.TryInit(_log, WorkaroundArgs.ExtractArgs(inst)) == true)
                    {
                        events.Add(temp);
                        _log.LogInformation("added event {event} to {worker}", temp, this);
                    }
                    else
                    {
                        _log.LogWarning("skip invalid action {eventDefinition} for {worker}", inst, this);
                    }
                }
                else
                {
                    _log.LogWarning("skipped unkown event {unknownEvent} for {worker}", key, this);
                }
            }

            foreach (var inst in _definition.actions)
            {
                //match everything until first parameter (indicated by "{") or until the end
                var key = Regex.Match(inst, @"^([^{])+").ToString();

                if (_actionFactory.KnowsType(key))
                {
                    if (actions == null)
                    {
                        actions = new List <IWorkaroundAction>();
                    }

                    IWorkaroundAction temp = _actionFactory.Create(key);

                    if (temp.TryInit(_log, WorkaroundArgs.ExtractArgs(inst)) == true)
                    {
                        actions.Add(temp);
                        _log.LogInformation("added action {action} to {worker}", temp, this);
                    }
                    else
                    {
                        _log.LogWarning("skip invalid action {actionDefinition} for {worker}", inst, this);
                    }
                }
                else
                {
                    _log.LogWarning("skipped unkown action {unknownAction} for {worker}", key, this);
                }
            }

            if (events == null)
            {
                _log.LogError("definition for {worker} has no valid events; worker execution skipped", this);
            }
            if (actions == null)
            {
                _log.LogError("definition for {worker} has no valid actions; worker execution skipped", this);
            }
        }
 internal static IWorkaroundWorker CreateWorker(ILogger <WorkaroundPublisherService> log, WorkaroundDefinition inst)
 {
     return(new WorkaroundWorker(log, inst));
 }