Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.DeliveryClient.SubmitEvents C# (CSharp) Метод

SubmitEvents() приватный Метод

Submits a single batch of events to the service.
private SubmitEvents ( List rowIds, List eventList ) : void
rowIds List Row identifiers. The list of rowId, that is unique identifier of each event.
eventList List The list of events that need to be submitted.
Результат void
        private void SubmitEvents(List<string> rowIds, List<Amazon.MobileAnalytics.Model.Event> eventList)
        {
            PutEventsRequest putRequest = new PutEventsRequest();
            putRequest.Events = eventList;
            putRequest.ClientContext = Convert.ToBase64String(
                                        System.Text.Encoding.UTF8.GetBytes(_clientContext.ToJsonString()));
            putRequest.ClientContextEncoding = "base64";
            _logger.DebugFormat("Client Context is : {0}", _clientContext.ToJsonString());

            PutEventsResponse resp = null;

            try
            {
                resp = _mobileAnalyticsLowLevelClient.PutEvents(putRequest);
            }
            catch (AmazonMobileAnalyticsException e)
            {
                _logger.Error(e, "An AmazonMobileAnalyticsException occurred while sending Amazon Mobile Analytics request: error code is {0} ; error type is {1} ; request id is {2} ; status code is {3} ; error message is {4}", e.ErrorCode, e.ErrorType, e.RequestId, e.StatusCode, e.Message);
                // Delete events in any of the three error codes.
                if (e.StatusCode == HttpStatusCode.BadRequest &&
                     (e.ErrorCode.Equals("ValidationException", StringComparison.CurrentCultureIgnoreCase) ||
                      e.ErrorCode.Equals("SerializationException", StringComparison.CurrentCultureIgnoreCase) ||
                      e.ErrorCode.Equals("BadRequestException", StringComparison.CurrentCultureIgnoreCase)))
                {
                    MobileAnalyticsErrorEventArgs eventArgs = new MobileAnalyticsErrorEventArgs(this.GetType().Name, "Amazon Mobile Analytics Service returned an error.", e, eventList);
                    _maManager.OnRaiseErrorEvent(eventArgs);

                    _logger.InfoFormat("The error code is not retriable. Delete {0} events from local storage.", rowIds.Count);
                    _eventStore.DeleteEvent(rowIds);
                }
                else
                {
                    MobileAnalyticsErrorEventArgs eventArgs = new MobileAnalyticsErrorEventArgs(this.GetType().Name, "Amazon Mobile Analytics Service returned an error.", e, new List<Amazon.MobileAnalytics.Model.Event>());
                    _maManager.OnRaiseErrorEvent(eventArgs);
                }
            }
            catch (AmazonServiceException e)
            {
                _logger.Error(e, "An AmazonServiceException occurred while sending Amazon Mobile Analytics request:  error code is {0} ; error type is {1} ; request id is {2} ; status code is {3} ; error message is {4} ", e.ErrorCode, e.ErrorType, e.RequestId, e.StatusCode, e.Message);
                MobileAnalyticsErrorEventArgs eventArgs = new MobileAnalyticsErrorEventArgs(this.GetType().Name, "Amazon Web Service returned an error.", e, new List<Amazon.MobileAnalytics.Model.Event>());
                _maManager.OnRaiseErrorEvent(eventArgs);
            }
            catch (Exception e)
            {
                _logger.Error(e, "An exception occurred while sending Amazon Mobile Analytics request.");
                MobileAnalyticsErrorEventArgs eventArgs = new MobileAnalyticsErrorEventArgs(this.GetType().Name, "An exception occurred when sending request to Amazon Mobile Analytics.", e, new List<Amazon.MobileAnalytics.Model.Event>());
                _maManager.OnRaiseErrorEvent(eventArgs);
            }
            finally
            {
                if (resp != null && resp.HttpStatusCode == HttpStatusCode.Accepted)
                {
                    _logger.InfoFormat("Mobile Analytics client successfully delivered {0} events to service. Delete those events from local storage.", rowIds.Count);
                    _eventStore.DeleteEvent(rowIds);
                }
                lock (_deliveryLock)
                {
                    _deliveryInProgress = false;
                }
            }

            
        }
#endif

Same methods

DeliveryClient::SubmitEvents ( List rowIds, List eventList ) : Task