//private readonly ILog _logger = LogManager.GetLogger("Runtime"); /// <summary> /// Create the Runtime object to combine all the various components of the livetiming. /// </summary> /// <param name="liveStream">A stream used to represent the incoming data of the live stream.</param> /// <param name="authKeyService">Provider for authorization key requests.</param> /// <param name="keyFrameService">Provider for keyframes.</param> /// <param name="messageDispatch">A receiver for messages.</param> public Runtime(Stream liveStream, IAuthKey authKeyService, IKeyFrame keyFrameService, IMessageDispatch messageDispatch) { _decryptor = new DataDecryptor(); _packetReader = new PacketReader(liveStream, new DecryptStreamDecorator(liveStream, _decryptor)); _messageDispatch = messageDispatch; _authKeyService = authKeyService; _keyFrameService = keyFrameService; }
public void RunOrEnqueue(IMessageDispatch dispatch, IMessageHandlerInvoker invoker) { if (IsCurrentDispatchQueue) { RunSingle(dispatch, invoker); } else { Enqueue(dispatch, invoker); } }
private void RunSingle(IMessageDispatch dispatch, IMessageHandlerInvoker invoker) { if (!_isRunning) { return; } RunInternal(new List <DispatchQueueEntry> { new DispatchQueueEntry(dispatch, invoker) }); }
public Task InvokeMessageHandler(IMessageDispatch message) { var handlers = _cache.GetHandlers(MessageHandlerType); foreach (var handler in handlers) { var invoker = _cache.GetMethodInfo(handler.GetType(), message.Message.GetType()); invoker.Invoke(handler, new object[] { message.Message }); } //refacto return(Task.CompletedTask); }
/// <summary> /// costruttore classe /// </summary> /// <param name="MessageDispatch"></param> public DocumentMonitor(IMessageDispatch MessageDispatch) { messageDispatch = MessageDispatch; try { fileWatcher = new FileSystemWatcher(); fileWatcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName; fileWatcher.Filter = "*.*"; fileWatcher.IncludeSubdirectories = true; fileWatcher.Created += OnFolderCreatedOrChanged; fileWatcher.Changed += OnFolderCreatedOrChanged; fileWatcher.Renamed += OnFolderRenamed; fileWatcher.Deleted += OnFolderDeleted; messageNotificationQueue = new Queue <DocumentMonitorData>(); } catch (Exception ex) { logger.Error(ex, "public DocumentMonitor(IMessageDispatch MessageDispatch)"); } }
public void Enqueue(IMessageDispatch dispatch, IMessageHandlerInvoker invoker) { _queue.Add(new DispatchQueueEntry(dispatch, invoker)); }
public DispatchQueueEntry(IMessageDispatch dispatch, IMessageHandlerInvoker invoker) { Dispatch = dispatch; Invoker = invoker; }