/// <summary> /// Processing the external event pay load received /// </summary> /// <param name="curExternalEventPayload">event pay load received</param> /// <param name="parser">delegate method</param> public async Task Process(string curExternalEventPayload, EventParser parser) { var client = ObjectFactory.GetInstance <IRestfulServiceClient>(); var fr8EventUrl = CloudConfigurationManager.GetSetting("CoreWebServerUrl") + "api/v1/events"; var eventReportCrateDTO = _crateManager.ToDto(await parser.Invoke(curExternalEventPayload)); if (eventReportCrateDTO != null) { Uri url = new Uri(fr8EventUrl, UriKind.Absolute); try { //TODO are we expecting a timeout?? await client.PostAsync(url, eventReportCrateDTO); } catch (TaskCanceledException) { //Timeout throw new TimeoutException( String.Format("Timeout while making HTTP request. \r\nURL: {0}, \r\nMethod: {1}", url.ToString(), HttpMethod.Post.Method)); } } }