Skip to content

Commit

Permalink
CMR-10285: Adding check before subscribing to AWS that the subscripti…
Browse files Browse the repository at this point in the history
…on is an ingest subscription. (#2200)
  • Loading branch information
eereiter authored Dec 18, 2024
1 parent 390d975 commit b10ce3f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions metadata-db-app/src/cmr/metadata_db/services/subscriptions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b10ce3f

Please sign in to comment.