private void SourceTransporter_PreviewDecodingInformation(object sender, ResonancePreviewDecodingInfoEventArgs e) { if (SourceTransporter.CheckPending(e.DecodingInformation.Token)) { return; } DoRouting(e, TargetTransporter); }
private void TargetTransporter_StateChanged(object sender, ResonanceComponentStateChangedEventArgs e) { if (e.NewState == ResonanceComponentState.Failed && DisconnectOnFailure && SourceTransporter.State == ResonanceComponentState.Connected) { Task.Factory.StartNew(async() => { Logger.LogInformation("Target transporter has failed. disconnecting target transporter..."); try { await SourceTransporter.DisconnectAsync($"The remote routed target transporter has failed: {TargetTransporter.FailedStateException.Message}."); } catch (Exception ex) { Logger.LogError(ex, "Error occurred while trying to disconnect the source transporter."); } }); } }