private void TargetTransporter_PreviewDecodingInformation(object sender, ResonancePreviewDecodingInfoEventArgs e) { if (TargetTransporter.CheckPending(e.DecodingInformation.Token)) { return; } DoRouting(e, SourceTransporter); }
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."); } }); } }