private void Output_OnError(object sender, ChannelErrorEventArgs e)
        {
            logger?.LogError(e.Error, "Fault in output channel.");

            if (!outputDisposed)
            {
                //restart the channel
                ExecuteOutputRetryPolicyAsync().Wait();
                OutputChannel.OpenAsync().GetAwaiter();
            }
        }
Example #2
0
 private void Output_OnClose(object sender, ChannelCloseEventArgs e)
 {
     try
     {
         logger?.LogWarning("Output channel closed.");
         logger?.LogInformation("Restarting output channel.");
         ExecuteOutputRetryPolicy();
         OutputChannel.OpenAsync().GetAwaiter();
     }
     catch (Exception ex)
     {
         logger?.LogError(ex, "Fault restarting module output channel.");
         throw ex;
     }
 }
        public override void Execute()
        {
            //wire up events
            InputChannel.OnOpen    += Input_OnOpen;
            InputChannel.OnReceive += Input_OnReceive;
            InputChannel.OnError   += Input_OnError;
            InputChannel.OnClose   += Input_OnClose;

            OutputChannel.OnClose   += Output_OnClose;
            OutputChannel.OnError   += Output_OnError;
            OutputChannel.OnReceive += Output_OnReceive;
            OutputChannel.OnOpen    += Output_OnOpen;

            try
            {
                InputChannel.OpenAsync().GetAwaiter();
                OutputChannel.OpenAsync().GetAwaiter();
            }
            catch (Exception ex)
            {
                OnPipelineError?.Invoke(this, new PipelineErrorEventArgs(Id, ex));
            }
        }
Example #4
0
        public override void Execute()
        {
            InputChannel.OnOpen    += Input_OnOpen;
            InputChannel.OnReceive += Input_OnReceive;
            InputChannel.OnError   += Input_OnError;
            InputChannel.OnClose   += Input_OnClose;

            OutputChannel.OnClose   += Output_OnClose;
            OutputChannel.OnError   += Output_OnError;
            OutputChannel.OnReceive += Output_OnReceive;
            OutputChannel.OnOpen    += Output_OnOpen;

            if (!InputChannel.IsConnected)
            {
                InputChannel.OpenAsync().GetAwaiter();
            }

            if (!OutputChannel.IsConnected)
            {
                OutputChannel.OpenAsync().GetAwaiter();
                //OutputChannel.ReceiveAsync().GetAwaiter();
            }
        }