private void ConsumeMessage(object message, IBackplaneConsumer consumer) { var stopwatch = Stopwatch.StartNew(); consumer.Consume(((dynamic)message).Data); stopwatch.Stop(); _backplaneMetrics.RecordProcessedMessage(consumer.GetType().Name, stopwatch.Elapsed.TotalMilliseconds); }
private bool TryFindConsumer(Guid type, out IBackplaneConsumer consumer) { consumer = _container.GetAllInstances <IBackplaneConsumer>().FirstOrDefault(x => x.ConsumesType == type); return(consumer != null); }