private async Task AddToQueueAsync(Models.GatewayServiceRequest.Content requestContent) { Models.LogMessage exceptionMsg = null; try { var serializedContent = JsonConvert.SerializeObject(requestContent); var queueItem = new Models.GatewayQueueItem { ID = Guid.NewGuid(), JsonSerializedRequestContent = serializedContent, QueuedDateTime = DateTime.Now }; try { await _queueItemRepository.InsertAsync(queueItem); } catch (Exception ex) { MvxTrace.Error("\"{0}\" in {1}.{2}\n{3}", ex.Message, "GatewayQueueItemRepository", "InsertAsync", ex.StackTrace); throw; } // Always attempt to sync with the MWF Mobile Gateway service whenever items are added to the queue (providing the GatewayQueueTimerService has been started) await UploadQueueAsync(); } catch (Exception ex) { exceptionMsg = _loggingService.GetExceptionLogMessage(ex); } if (exceptionMsg != null) { await _loggingService.LogEventAsync(exceptionMsg); } }
private Task <HttpResult <Models.GatewayServiceResponse.Response <TData> > > PostAsync <TData>(Models.GatewayServiceRequest.Content content) where TData : class { return(_httpService.PostAsJsonAsync <Models.GatewayServiceRequest.Content, Models.GatewayServiceResponse.Response <TData> >(content, _gatewayDeviceRequestUrl)); }