From 653f05da7adb5c5ce5213a1847b0df96bf3c32b7 Mon Sep 17 00:00:00 2001 From: Erich Reiter Date: Tue, 17 Dec 2024 11:55:13 -0500 Subject: [PATCH] CMR-10285: Adding check before subscribing to AWS that the subscription is an ingest subscription. --- .../src/cmr/metadata_db/services/subscriptions.clj | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/metadata-db-app/src/cmr/metadata_db/services/subscriptions.clj b/metadata-db-app/src/cmr/metadata_db/services/subscriptions.clj index 2b2732ebb6..35ca69db21 100644 --- a/metadata-db-app/src/cmr/metadata_db/services/subscriptions.clj +++ b/metadata-db-app/src/cmr/metadata_db/services/subscriptions.clj @@ -115,17 +115,19 @@ the topic." [context concept] (when-let [concept-edn (convert-concept-to-edn concept)] - (let [topic (get-in context [:system :sns :external])] - (topic-protocol/subscribe topic concept-edn)))) + (when (ingest-subscription-concept? concept-edn) + (let [topic (get-in context [:system :sns :external])] + (topic-protocol/subscribe topic concept-edn))))) (defn delete-subscription "Remove the subscription from the cache and unsubscribe the subscription from the topic." [context concept] (when-let [concept-edn (add-delete-subscription context concept)] - (let [topic (get-in context [:system :sns :external])] - (topic-protocol/unsubscribe topic {:concept-id (:concept-id concept-edn) - :subscription-arn (get-in concept-edn [:extra-fields :aws-arn])})))) + (when (ingest-subscription-concept? concept-edn) + (let [topic (get-in context [:system :sns :external])] + (topic-protocol/unsubscribe topic {:concept-id (:concept-id concept-edn) + :subscription-arn (get-in concept-edn [:extra-fields :aws-arn])}))))) ;; ;; The functions below are for refreshing the subscription cache if needed.