Example #1
0
        protected IConnector RunPipe(IPipe pipe, IDictionary <string, object> load)
        {
            var beforeRunPipeEventArgs = new BeforePipeRunEventArgs(pipe, load);

            BeforePipeRun?.Invoke(this, beforeRunPipeEventArgs);

            if (beforeRunPipeEventArgs.Skip)
            {
                return(pipe.OutputConnector);
            }

            try
            {
                pipe.Process(load);
                PipeSuccess?.Invoke(this, new PipeSuccessEventArgs(pipe, load));
            }
            catch (Exception ex)
            {
                var errorEventArgs = new PipeErrorEventArgs(pipe, load, ex);

                PipeError?.Invoke(this, errorEventArgs);

                if (errorEventArgs.ErrorAction == ErrorAction.Rethrow)
                {
                    throw;
                }
            }

            return(pipe.OutputConnector);
        }
Example #2
0
 private TransformBlock <OperationContext, OperationContext> CreateBlock(IPipe pipe)
 {
     if (pipe == null)
     {
         return(new TransformBlock <OperationContext, OperationContext>(t => t));
     }
     else
     {
         return(new TransformBlock <OperationContext, OperationContext>(context =>
         {
             if (!context.IsCompleted)
             {
                 try
                 {
                     pipe.Process(context);
                 }
                 catch (Exception ex)
                 {
                     context.CompleteWithException(ex);
                 }
             }
             return context;
         }));
     }
 }
Example #3
0
 public override void Process(IDictionary <string, object> load)
 => _pipe.Process(load);