public Task TransmitMessageAsync(OperationInvocation operationInvocation) { Console.WriteLine($"== MESSAGE ASYNC =="); Console.WriteLine(GetOperationDetails(operationInvocation)); return(Task.CompletedTask); }
/// <inheritdoc /> public T TransmitRequest <T>(OperationInvocation operationInvocation) { if (operationInvocation == null) { throw new ArgumentNullException(nameof(operationInvocation)); } return(this.TransmitRequestAsync <T>(operationInvocation).GetAwaiter().GetResult()); }
/// <inheritdoc /> public void TransmitMessage(OperationInvocation operationInvocation) { if (operationInvocation == null) { throw new ArgumentNullException(nameof(operationInvocation)); } this.TransmitMessageAsync(operationInvocation).GetAwaiter().GetResult(); }
/// <summary> /// Transmits an operation invocation which represents a request asynchronously. /// </summary> /// <param name="operationInvocation">The operation invocation to transmit.</param> /// <returns>The result of the request.</returns> public async Task<T> TransmitRequestAsync<T>(OperationInvocation operationInvocation) { if (operationInvocation == null) { throw new ArgumentNullException(nameof(operationInvocation)); } var func = this.Receiver.GetOperationImplementation(operationInvocation.Name, operationInvocation.Parameters.Select(p => p.CSharpTypeName), out _); return (T)await func(operationInvocation); }
/// <summary> /// Transmits an operation invocation which represents a request. /// </summary> /// <param name="operationInvocation">The operation invocation to transmit.</param> /// <returns>The result of the request.</returns> public T TransmitRequest<T>(OperationInvocation operationInvocation) { if (operationInvocation == null) { throw new ArgumentNullException(nameof(operationInvocation)); } var func = this.Receiver.GetOperationImplementation(operationInvocation.Name, operationInvocation.Parameters.Select(p => p.CSharpTypeName), out _); return (T)func(operationInvocation).GetAwaiter().GetResult(); }
/// <inheritdoc /> public async Task TransmitMessageAsync(OperationInvocation operationInvocation) { if (operationInvocation == null) { throw new ArgumentNullException(nameof(operationInvocation)); } RequestResult result = await this.Client.SendRequest(new Request(Constants.MessageType, operationInvocation)); result.ThrowOnError(); }
private async Task InvokeOperationWithMessage(Message message) { OperationInvocation op = message.GetBody <OperationInvocation>(); var invokeFunc = this.ReceiverImplementation.GetOperationImplementation(op, out IEnumerable <Type> parameterTypes); object invocationResult = await invokeFunc(op); if (message.IsRequest()) { Response response = message.CreateResponse(invocationResult); await this.Connection.SendMessage(response); } }
/// <inheritdoc /> public Delegates.ExecuteOperationFunc GetOperationImplementation(OperationInvocation operationInvocation, out IEnumerable <Type> parameterTypes) { if (operationInvocation == null) { throw new ArgumentNullException(nameof(operationInvocation)); } return(this.GetOperationImplementation( operationInvocation.Name, operationInvocation.Parameters.Select(p => p.CSharpTypeName), out parameterTypes)); }
/// <inheritdoc /> public async Task <T> TransmitRequestAsync <T>(OperationInvocation operationInvocation) { if (operationInvocation == null) { throw new ArgumentNullException(nameof(operationInvocation)); } // Create the request Request request = new Request(Constants.MessageType, operationInvocation); // Send the request RequestResult result = await this.Client.SendRequest(request); // If the request failed, throw an exception result.ThrowOnError(); // Return the result return(result.Response.GetBody <T>()); }
public T TransmitRequest <T>(OperationInvocation operationInvocation) { Console.WriteLine($"== REQUEST =="); Console.WriteLine(GetOperationDetails(operationInvocation, typeof(T))); return(default);
public void TransmitMessage(OperationInvocation operationInvocation) { Console.WriteLine(); Console.WriteLine($"== MESSAGE =="); Console.WriteLine(GetOperationDetails(operationInvocation)); }