Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMR-10285: Adding check before subscribing to AWS that the subscription is an ingest subscription. #2200

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading