protected virtual async Task Handle(IHandlerData data)
 {
     if (_nextHandler != null)
     {
         await _nextHandler?.Handle(data);
     }
 }
 public async Task Handle(IHandlerData telegram)
 {
     await new ExceptionHandler()
     .SetRoot()
     .Next(new DownloadMp3())
     .Next((new SendMp3ToUser()))
     .Next(new NotifyAdmins())
     .Run(telegram);
 }
 public async Task Run(IHandlerData data)
 {
     if (_isRoot)
     {
         await Handle(data);
     }
     else
     {
         _prevHandler?.Run(data);
     }
 }
 protected override async Task Handle(IHandlerData data)
 {
     try
     {
         await base.Handle(data);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         //handle the exception here
     }
 }
        protected override async Task Handle(IHandlerData data)
        {
            if (!(data is OrderData order))
            {
                throw new ArgumentNullException();
            }
            order.State = nameof(ProducingHandler);

            Console.WriteLine($"State:{nameof(ProducingHandler)} objectState: " +
                              $"{JsonConvert.SerializeObject(order)}");
            await base.Handle(order);
        }
 protected override async Task Handle(IHandlerData data)
 {
     Console.WriteLine("Sending MP3 to user ...");
     await base.Handle(data);
 }
예제 #7
0
 public Task Handle(IHandlerData telegram)
 {
     throw new System.NotImplementedException();
 }
예제 #8
0
        public IHandlerData SetNext(IHandlerData handler)
        {
            this._nextHandler = handler;

            return(handler);
        }
예제 #9
0
 protected override async Task Handle(IHandlerData data)
 {
     Console.WriteLine("Downloading ... ");
     await base.Handle(data);
 }
예제 #10
0
 public MessageBus(IHandlerData handlerData, IOptions <MessageQueueConfiguration> messageQueueConfiguration)
 {
     _messageQueueConfiguration = messageQueueConfiguration.Value;
     _handlerData = handlerData;
     _queueClient = new QueueClient(_messageQueueConfiguration.Connectionstring, _messageQueueConfiguration.QueueName);
 }
예제 #11
0
 protected override async Task Handle(IHandlerData data)
 {
     Console.WriteLine("Notifying Admins ...");
     await base.Handle(data);
 }