public void PushNotifications() { var batchSize = CprBroker.Config.Properties.Settings.Default.DataChangeDequeueBatchSize; Admin.LogFormattedSuccess("DataChangeEventEnqueuer.PushNotifications() started, batch size <{0}>", batchSize); bool moreChangesExist = true; while (moreChangesExist) { var resp = EventsService.DequeueDataChangeEvents(batchSize); var changedPeople = resp.Item; if (changedPeople == null) { changedPeople = new EventBroker.EventsService.DataChangeEventInfo[0]; } moreChangesExist = changedPeople.Length == batchSize; Admin.LogFormattedSuccess("DataChangeEventEnqueuer.PushNotifications(): <{0}> data changes found", changedPeople.Length); using (var dataContext = new Data.EventBrokerDataContext()) { var dbObjects = Array.ConvertAll <EventsService.DataChangeEventInfo, Data.DataChangeEvent>( changedPeople, p => new Data.DataChangeEvent() { DataChangeEventId = p.EventId, DueDate = p.ReceivedDate, PersonUuid = p.PersonUuid, PersonRegistrationId = p.PersonRegistrationId, ReceivedDate = DateTime.Now } ); dataContext.DataChangeEvents.InsertAllOnSubmit(dbObjects); dataContext.SubmitChanges(); DateTime now = DateTime.Now; MatchDataChangeEvents(dataContext, dbObjects, now); dataContext.UpdatePersonLists(now, (int)Data.SubscriptionType.SubscriptionTypes.DataChange); dataContext.EnqueueDataChangeEventNotifications(now, (int)Data.SubscriptionType.SubscriptionTypes.DataChange); //TODO: Move this logic to above stored procedure dataContext.DataChangeEvents.DeleteAllOnSubmit(dbObjects); dataContext.SubmitChanges(); } } }