From daac63d4f7c2f0e8e318b4a0ca1e0554800b8f40 Mon Sep 17 00:00:00 2001 From: yliu13 Date: Wed, 12 Jun 2024 14:45:36 -0700 Subject: [PATCH] fix: apix-1705 use for loop to avoid confusion --- .../service/queue/QueueProcessor.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/intuit/developer/sampleapp/webhooks/service/queue/QueueProcessor.java b/src/main/java/com/intuit/developer/sampleapp/webhooks/service/queue/QueueProcessor.java index fed7688..5ab8e38 100644 --- a/src/main/java/com/intuit/developer/sampleapp/webhooks/service/queue/QueueProcessor.java +++ b/src/main/java/com/intuit/developer/sampleapp/webhooks/service/queue/QueueProcessor.java @@ -61,19 +61,19 @@ public Object call() throws Exception { //Convert payload to obj WebhooksEvent event = service.getWebhooksEvent(payload); - EventNotification eventNotification = event.getEventNotifications().get(0); + for (EventNotification eventNotification : event.getEventNotifications()) { - // get the company config - CompanyConfig companyConfig = companyConfigService.getCompanyConfigByRealmId(eventNotification.getRealmId()); + // get the company config + CompanyConfig companyConfig = companyConfigService.getCompanyConfigByRealmId(eventNotification.getRealmId()); - // perform cdc with last updated timestamp and subscribed entities - String cdcTimestamp = DateUtils.getStringFromDateTime(DateUtils.getCurrentDateTime()); - cdcService.callDataService(companyConfig); - - // update cdcTimestamp in companyconfig - companyConfig.setLastCdcTimestamp(cdcTimestamp); - companyConfigService.save(companyConfig); + // perform cdc with last updated timestamp and subscribed entities + String cdcTimestamp = DateUtils.getStringFromDateTime(DateUtils.getCurrentDateTime()); + cdcService.callDataService(companyConfig); + // update cdcTimestamp in companyconfig + companyConfig.setLastCdcTimestamp(cdcTimestamp); + companyConfigService.save(companyConfig); + } } return null;