Beispiel #1
0
 private static void OnNext(ISynchronizationAction <T> action)
 {
     try
     {
         action.Execute();
         // Could also added interceptor on this.
         Debug.WriteLine(action);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(action + " Failed with message " + ex.Message);
     }
 }
Beispiel #2
0
 public override SynchronizationResult Process(ISynchronizationAction <TItem> action)
 {
     try
     {
         return(action.Execute());
     }
     catch (Exception ex)
     {
         // Error handling scenario's/needs, which currently don't need support for yet.
         // * Rollback a transaction.
         // * Log the error.
         // * Swallow the exception and just continue.
         // * Add information to the catched/rethrown exception?
         throw new DispatchingException($"Failed executing action {action.Name} on {action.Applicant}!", ex);
     }
 }
        /*
         * public ISynchronizationAction<TSynch> ChangeResolver([NotNull] TSynch item)
         * {
         *  if (item == null) {  throw new ArgumentNullException(nameof(item)); }
         *
         *  // TODO: Error handling?
         *  //return _channelConfig.SynchronizationResolvers.FirstOrDefault(action => action.AppliesTo(item)) ?? new NullSynchAction<TSynch>();
         *  // Injecting NullSynchActions provides means of logging
         * }
         */

        public SynchronizationResult Dispatcher(ISynchronizationAction <TSynch> synchAction)
        {
            // TODO: Error handling
            return(synchAction.Execute());
        }