       ;; if in :normal mode do the same thing as before
       ;; if in :failure mode return
       ;; {:status :retry :message "Queue is in failure mode"}
-      (let [resp (handler context msg)]
-        (debug "Processing message")
-        (case (:status resp)
-          :ok (set-message-state broker-wrapper msg :processed)
-
-          :retry (when (queue/retry-limit-met? msg (count (iconfig/rabbit-mq-ttls)))
-                   (set-message-state broker-wrapper msg :failed))
-
-          :fail (set-message-state broker-wrapper msg :failed)
-
-          (throw (Exception. (str "Invalid response: " (pr-str resp)))))
+      (let [resp (handler context msg)
+            message-state (case (:status resp)
+                            :ok (set-message-state broker-wrapper msg :processed)
+
+                            :retry (when (queue/retry-limit-met? msg (count (iconfig/rabbit-mq-ttls)))
+                                     (set-message-state broker-wrapper msg :failed))
+
+                            :fail (set-message-state broker-wrapper msg :failed)
+
+                            (throw (Exception. (str "Invalid response: " (pr-str resp)))))]
+        (update-message-queue-history :process msg message-state)
         resp))))
 
 (defn- current-message-states

            [cmr.message-queue.services.queue :as queue]
            [cmr.message-queue.config :as iconfig]
            [cmr.common.log :as log :refer (debug info warn error)]
            [clojure.set :as set]))

(def message-id-key
  "Key used to track messages within a message map. Each message will have a unique id."


      ;; Set the initial state of the message to :initial
      (set-message-state this tagged-msg :initial)
      (update-message-queue-history :enqueue tagged-msg :initial)

      ;; delegate the request to the wrapped broker
      (queue/publish queue-broker queue-name tagged-msg)))
