예제 #1
0
        public async Task Start()
        {
            _multiplexer = await ConnectionMultiplexer.ConnectAsync(_connectionString);

            _subscriber = _multiplexer.GetSubscriber();
            _subscriber.Subscribe(_channel, (channel, message) => {
                var evt = JsonConvert.DeserializeObject(message, _serializerSettings);
                //TODO: split out future commands
                if (evt is NewDefinitionCommand)
                {
                    try
                    {
                        if ((evt as NewDefinitionCommand).Originator == _nodeId)
                        {
                            return;
                        }
                        var def = _repository.Find((evt as NewDefinitionCommand).DefinitionId, (evt as NewDefinitionCommand).Version);
                        _loader.LoadDefinition(def);
                    }
                    catch (Exception ex)
                    {
                        _logger.LogError(default(EventId), ex, ex.Message);
                    }
                }
            });
        }
예제 #2
0
 public Definition GetDefinition(string id)
 {
     return(_repository.Find(id));
 }