public OutcomingInvocation( OutcomingInvocationDescriptor descriptor, ITransportChannel channel, IProtocolImplementation protocol, IMarshaller <TRequest> requestMarshaller, IMarshaller <TResponse> responseMarshaller) : base(channel, protocol, requestMarshaller, responseMarshaller) { _channel = channel; _log = LogManager.GetLogger <OutcomingInvocation <TRequest, TResponse> >(_channel.Id.ToString()); Info = descriptor; _protocol = protocol; }
public async ValueTask <IOutcomingInvocation <TRequest, TResponse> > CreateAsync <TRequest, TResponse>( MethodCallDescriptor methodCall, Maybe <TRequest> request = default, Maybe <ContextLinkageOptions> contextLinkageOptions = default) { var channel = await _connection.CreateChannelAsync().ConfigureAwait(false); InvocationMethodDescriptor methodDescriptor = null; InvocationTargetDescriptor targetDescriptor = null; if (methodCall.Method.HasValue) { var method = methodCall.Method.Value; methodDescriptor = new InvocationMethodDescriptor(method.Service.Id, method.Name, method.Service.Alias); } if (methodCall.ProvidedMethod.HasValue) { var method = methodCall.ProvidedMethod.Value; methodDescriptor = new InvocationMethodDescriptor(method.ProvidedService.ServiceId, method.Name, method.ProvidedService.ServiceId); targetDescriptor = new InvocationTargetDescriptor(method.ProvidedService.ApplicationId, method.ProvidedService.ConnectionId, method.ProvidedService.ServiceAlias); } var descriptor = new OutcomingInvocationDescriptor(methodDescriptor, targetDescriptor, contextLinkageOptions); var invocation = new OutcomingInvocation <TRequest, TResponse>( descriptor, channel, _protocol, GetMarshaller <TRequest>(), GetMarshaller <TResponse>()); invocation.Start(); if (request.HasValue) { await invocation.Out.WriteAsync(request.Value).ConfigureAwait(false); invocation.Out.TryComplete(); } return(invocation); }