   "Convert an Amazon Resource Name (ARN) to a name (topic, queue, etc.)."
   [arn]
   (string/replace arn #".*:" ""))
+
+(defn- http-url->name
+  "Convert an Amazon HTTP queue endpoint URL to a queue name."
+  [endpoint]
+  (last (string/split endpoint #"/")))
+
+(defn- subscription-endpoint->name
+  "Given a subscription endpoint (which may be an ARN or an HTTP URL), convert
+  it to a queue name."
+  [endpoint]
+  (debug "Converting endpoint:" endpoint)
+  (if (string/starts-with? endpoint "http")
+    (http-url->name endpoint)
+    (arn->name endpoint)))
 
 (defn- normalize-queue-name
   "Ensure all queues start with gsfc-eosdis-cmr since the permissions in NGAP specify that CMR


(defn- -get-queue-url
  "Returns the queue url for the given queue name."
  [sqs-client queue-name]
  (info "Calling SQS to get URL for queue " queue-name)
  (.getQueueUrl (.getQueueUrl sqs-client queue-name)))


  method with the given args."
  [client-obj method args]
  (when-not (nil? (first args))
    (debug "\tConfig:" method "=" args)
    (Reflector/invokeInstanceMethod
     client-obj (name method) (object-array args))))

