public async Task <IActionResult> Index() { currentChannelProvider = channelResolver.GetCurrentChannelProvider(channelProviders); if (currentChannelProvider == null) { Response.StatusCode = 404; return(new EmptyResult()); } var currentChannel = await currentChannelProvider.GetChannel(); if (currentChannel == null) { Response.StatusCode = 404; return(new EmptyResult()); } if (ShouldRedirect(currentChannel, HttpContext)) { Response.Redirect(currentChannel.RemoteFeedUrl, false); } var xml = xmlFormatter.BuildXml(currentChannel); return(new XmlResult(xml)); }
public IConnectionSession <TRequest, TResponse> CreateSession(string methodFullName, MethodType methodType) { var method = _methodFactory.Create(methodFullName, methodType); var targetIpResult = _connectionTargetProvider.GetTarget(method.ServiceName); SessionHelper.HandleIfError(targetIpResult, _logger); var channelResult = _channelProvider.GetChannel(targetIpResult.Value); SessionHelper.HandleIfError(channelResult, _logger); return(new ConnectionSession <TRequest, TResponse>(channelResult.Value, method, _metricRepository, _configurationProvider, _logger)); }
/// <summary> /// Invokes a method on the target <typeparamref name="TService"/>. /// </summary> /// <typeparam name="TService">The type of service to invoke.</typeparam> /// <typeparam name="TResult">The return type of the service invocation.</typeparam> /// <param name="function">A function delegate that represents the service method to be invoked.</param> /// <returns>The return value from the service invocation.</returns> public TResult Invoke <TService, TResult>(Func <TService, TResult> function) { var channel = channelProvider.GetChannel <TService>(); try { TResult result = function(channel); ((IClientChannel)channel).Close(); return(result); } catch { ((IClientChannel)channel).Abort(); throw; } }
private IModel GetMqChannel() => ChannelProvider.GetChannel().MqChannel;
/// <summary> /// Gebruik deze method om een method van een service aan te roepen. /// </summary> /// <typeparam name="I">ServiceContract aan te roepen service</typeparam> /// <param name="operation">Lambda-expressie die de vertrekkende van <typeparamref name="I"/> /// de gewenste method oproept.</param> /// <example> /// <c>CallService <IMijnService, string> (svc => svc.IetsDoen(id))</c> /// </example> // ReSharper disable InconsistentNaming public void CallService <I>(Action <I> operation) where I : class // ReSharper restore InconsistentNaming { Call(_channelProvider.GetChannel <I>(), operation); }
/// <summary> /// Gets a channel for the specified remote note. /// </summary> /// <param name="node"></param> /// <returns></returns> public ISenderChannel?GetChannel(Node node) => _channelProvider.GetChannel(node);