private LowLevel.Request CreateLowLevelRequest(Request request, RequestParameters overrideParams = null) { LowLevel.Request req = new LowLevel.Request() { RequestType = this.RequestType, Channel = this.ChannelName, ClientID = this.ClientID, Timeout = this.Timeout, CacheKey = this.CacheKey, CacheTTL = this.CacheTTL, RequestID = request.RequestID, Body = request.Body, Metadata = request.Metadata }; if (overrideParams != null) { if (overrideParams.Timeout.HasValue) { req.Timeout = overrideParams.Timeout.Value; } if (overrideParams.CacheKey != null) { req.CacheKey = overrideParams.CacheKey; } if (overrideParams.CacheTTL.HasValue) { req.CacheTTL = overrideParams.CacheTTL.Value; } } return(req); }
public async Task <string> CallServiceAsync(string receiver, string data, TimeSpan timeOut) { try { var request = new Request() { Channel = receiver, Metadata = "", Body = Encoding.UTF8.GetBytes(data), Timeout = (int)timeOut.TotalMilliseconds, RequestType = RequestType.Query, ClientID = _id, }; var response = await _initiator.SendRequestAsync(request); return(Encoding.UTF8.GetString(response.Body)); } catch (Exception e) { _logger.LogError(e, "Can`t get response from rpc"); } return(null); }