   (memoize -get-queue-url))
 
 (defn set-aws-client-attr!
-  "Conditionally configure the AWS client instance based passed as an argument."
-  [client-obj [method value]]
-  (when (complement (nil? value))
+  "Conditionally configure the AWS client instance with by calling the given
+  method with the given args."
+  [client-obj method args]
+  (when-not (nil? (first args))
+    (info "\tConfig:" method "=" args)
     (Reflector/invokeInstanceMethod
-     client-obj (name method) (object-array [value]))))
+     client-obj (name method) (object-array args))))
 
 (defn configure-aws-client
   "Configure an AWS service client with values passed pair-wise to the methods

  {:default nil
   :type String})

(defconfig sns-endpoint
  "By default the SNS client will not explicitly set the SNS endpoint. This
  configuration is provided for use in situations where explicitly setting
  the SNS endpoint is desirable or required."
  {:default nil
   :type String})

(defconfig sqs-extend-policy-remaining-exchanges
  "When subscribing a queue to a topic, one may override the AWS policy or
  extend it. CMR's default behaviour for AWS is to not extend the policy
  of the queue that is bound to the first in a set of exchanges, but to do
  so for the remaining exchanges.

  When running SQS/SNS locally, however, to keep policy handling simple, we
  do not want to extend the policies."
  {:default true
   :type Boolean})

(defn queue-visibility-timeout
  "Number of seconds SQS should wait after a message is read from a provider queue before making

  it is best to define the default configuration value as nil, so as to avoid
  unexpected client behaviour."
  [client-obj & args]
  (info "Configuring client" client-obj)
  (doseq [[config-key config-vals] (partition 2 args)]
    (set-aws-client-attr! client-obj config-key config-vals))
  client-obj)

(defmulti create-aws-client
  "Create an AWS service client, conditionally setting any configured values.

  Note that if the configuration calls (e.g., `(sqs-endpoint)`) return `nil`,
  the configuration operation doesn't actually take place."
  identity)

(defmethod create-aws-client :sqs
  [^Keyword type]
  (let [endpoint (sqs-endpoint)]
    (if (nil? endpoint)
      (new AmazonSQSClient)
      (configure-aws-client
        (new AmazonSQSClient (new BasicAWSCredentials "unused" "unused"))
        :setEndpoint [endpoint]))))

(defmethod create-aws-client :sns
  [^Keyword type]
  (let [endpoint (sns-endpoint)]
    (if (nil? endpoint)
      (new AmazonSNSClient)
      (configure-aws-client
        (new AmazonSNSClient (new BasicAWSCredentials "unused" "unused"))
        :setEndpoint [endpoint]))))

(defrecord SQSQueueBroker
  ;; A record containing fields related to accessing SNS/SQS exchanges and queues.
