Example #1
0
 private void TargetTransporter_PreviewDecodingInformation(object sender, ResonancePreviewDecodingInfoEventArgs e)
 {
     if (TargetTransporter.CheckPending(e.DecodingInformation.Token))
     {
         return;
     }
     DoRouting(e, SourceTransporter);
 }
Example #2
0
        private void SourceTransporter_StateChanged(object sender, ResonanceComponentStateChangedEventArgs e)
        {
            if (e.NewState == ResonanceComponentState.Failed && DisconnectOnFailure && TargetTransporter.State == ResonanceComponentState.Connected)
            {
                Task.Factory.StartNew(async() =>
                {
                    Logger.LogInformation("Source transporter has failed. disconnecting target transporter...");

                    try
                    {
                        await TargetTransporter.DisconnectAsync($"The remote routed source transporter has failed: {SourceTransporter.FailedStateException.Message}.");
                    }
                    catch (Exception ex)
                    {
                        Logger.LogError(ex, "Error occurred while trying to disconnect the target transporter.");
                    }
                });
            }
        }