From 7f3f7888e7dc291d95846564669a60a0e9966cf6 Mon Sep 17 00:00:00 2001 From: GeloPakDev1 Date: Thu, 9 Nov 2023 16:25:15 +0500 Subject: [PATCH] MSEARCH-617 Ignore hard-delete domain authority events --- NEWS.md | 2 +- .../search/integration/ResourceChangeFilterStrategy.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 050b57336..5a9325956 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,7 +7,7 @@ * Requires `API_NAME vX.Y` ### Features -* Description ([ISSUE_NUMBER](https://issues.folio.org/browse/ISSUE_NUMBER)) +* Add filter to ignore hard-delete authority events ([MSEARCH-617](https://issues.folio.org/browse/MSEARCH-617)) ### Bug fixes * Fix secure setup of system users by default ([MSEARCH-608](https://issues.folio.org/browse/MSEARCH-608)) diff --git a/src/main/java/org/folio/search/integration/ResourceChangeFilterStrategy.java b/src/main/java/org/folio/search/integration/ResourceChangeFilterStrategy.java index 7e9c857b8..884f69720 100644 --- a/src/main/java/org/folio/search/integration/ResourceChangeFilterStrategy.java +++ b/src/main/java/org/folio/search/integration/ResourceChangeFilterStrategy.java @@ -18,11 +18,10 @@ public boolean filter(ConsumerRecord consumerRecord) { var resourceEvent = consumerRecord.value(); var resourceName = resourceEvent.getResourceName(); var resourceEventType = resourceEvent.getType(); - if (resourceEventType == ResourceEventType.DELETE) { - log.info("Processing resource event [resourceName: {}]", resourceName); - if (resourceName != null && resourceName.equals(AUTHORITY_RESOURCE) - && resourceEvent.getSubType() == ResourceEventSubType.HARD_DELETE) { - log.info("Skip event. No need to process event for authority resource"); + if (ResourceEventType.DELETE == resourceEventType) { + if (AUTHORITY_RESOURCE.equals(resourceName) + && ResourceEventSubType.HARD_DELETE == resourceEvent.getSubType()) { + log.info("Skip hard-delete event. No need to process event for authority resource"); return true; } }