public Task NotifySubscriberAsync(CodeLineScanEvent e)
 {
     return(Task.Factory.StartNew(() =>
     {
         using (LogProvider.OpenNestedContext("Task_NotifySubscriber_CodeLineScan"))
         {
             log.Info("Notify remote subscriber of scan");
             log.DebugFormat("Begin call remote notification of scan [{0}]", e);
             try
             {
                 _subscriber.HandlerScan(
                     new ScanResult {
                     ValidationResult = (int)(e.CodeLineData.CodelineValidationResult), Contents = e.CodeLineData.Surname
                 }
                     );
             }
             catch (Exception ex)
             {
                 log.WarnFormat("Unable to notify remote subscriber of scan  [{0}]", ex.Message);
                 IsOpen = false;
             }
             log.DebugFormat("End call remote notification of scan");
         }
     }));
 }
示例#2
0
 private void HandleCodeLineScan(object sender, CodeLineScanEvent e)
 {
     // TODO consider doing the two tasks in parallel
     log.InfoFormat("Begin processing Scan", e);
     if (subscriber != null)
     {
         try
         {
             log.InfoFormat("Begin Scan callback trigger [{0}]", e);
             subscriber.OnScanEvent();
             log.Info("End Scan callback trigger ");
         }
         catch (Exception ex)
         {
             log.ErrorFormat("Failed to deliver Scan Event to subscriber [{0}]", e);
             log.ErrorFormat("Exception during handling of Scan Event notification [{0}]", ex);
         }
     }
     try
     {
         scanSink.HandleCodeLineScan(sender, e);
     }
     catch (Exception ex)
     {
         log.ErrorFormat("Exception durning deliverying scan [{0}]", ex);
     }
     log.InfoFormat("End processing Scan", e);
 }
示例#3
0
 public void NotifyAll(CodeLineScanEvent e)
 {
     log.Info("NotifyAll subscribers asynchronously of scanned document");
     foreach (var subscriber in _subscribers.Values)
     {
         try
         {
             log.Info("Notifying subscriber async of scanned document");
             subscriber.NotifySubscriberAsync(e);
         }
         catch (Exception ex)
         {
             log.ErrorFormat("Failed to deliver Scan Event to subscriber [{0}]", e);
             log.ErrorFormat("Exception during handling of Scan Event notification [{0}]", ex);
         }
     }
 }
示例#4
0
        private void HandleCodeLineScan(object sender, CodeLineScanEvent e)
        {
            log.Info("Handling CodeLineScan");
            log.DebugFormat("Begin processing Scan", e);
            subscribers.NotifyAll(e);

            try
            {
                log.Info("Putting scanned document asynchronously into cloud");
                scanStoreCloud.CodeLineDataPutAsync(e);
            }
            catch (Exception ex)
            {
                log.ErrorFormat("Exception during delivery of scan [{0}]", ex);
            }

            log.Debug("End processing Scan");
        }
示例#5
0
 private void HandleCodeLineScanEvent(object sender, CodeLineScanEvent e)
 {
     documentSink.CodeLineDataPutAsync(e);
 }