Esempio n. 1
0
        public async Task <int> UpdateEventAsync(WebhookEventQueueEntity updatingEvent)
        {
            int affectRows;

            using (IDbConnection connection = _dbConnection.CreateStagingConnection())
            {
                affectRows = await connection.ExecuteAsync(
                    $@"update dbo.WebhookEventQueue
                    set [CorrelationId] = @CorrelationId 
                    , [EnqueueDtTm] = @EnqueueDtTm
                    , [PickupDtTm] = @PickupDtTm
                    , [StatusId] = @StatusId
                    , [ThrottleId] = @ThrottleId
                    , [WorkerId] = @WorkerId
                    , [FinishDtTm] = @FinishDtTm
                    , [ErrorMsgTxt] = @ErrorMsgTxt
                    where Id=@Id", new
                {
                    updatingEvent.CorrelationId,
                    updatingEvent.EnqueueDtTm,
                    updatingEvent.PickupDtTm,
                    updatingEvent.StatusId,
                    updatingEvent.ThrottleId,
                    updatingEvent.WorkerId,
                    updatingEvent.FinishDtTm,
                    updatingEvent.ErrorMsgTxt,
                    updatingEvent.Id
                }, commandType : CommandType.Text).ConfigureAwait(false);
            }
            return(affectRows);
        }
Esempio n. 2
0
        public async Task <int> PerformEventThrottlingAsync(string updatingIds, int throttleId, int throttleStatusId,
                                                            DateTimeOffset pickupDateTime, DateTimeOffset finishDateTime,
                                                            WebhookEventQueueEntity updatingEvent)
        {
            int throttledEvents;
            int processingEvent;

            using (var transaction = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                throttledEvents =
                    await ThrottlingEventAsync(updatingIds, throttleId, throttleStatusId, pickupDateTime,
                                               finishDateTime).ConfigureAwait(false);

                processingEvent = await UpdateEventAsync(updatingEvent).ConfigureAwait(false);

                transaction.Complete();
            }

            return(throttledEvents + processingEvent);
        }
 public EnqueueEncompassEventEntity()
 {
     WebhookEvent = new WebhookEventEntity();
     EventDetail  = new EncompassEventDetail();
     EventQueue   = new WebhookEventQueueEntity();
 }
Esempio n. 4
0
 private bool IsValidEventToProcess(WebhookEventQueueEntity eventQueue)
 {
     return(eventQueue.Id > 0);
 }