 
 
 (defn handle-message
-  [ch metadata ^bytes payload]
+  [options ch metadata ^bytes payload]
   (let [body (json/read-json (String. payload "UTF-8"))
         ;; {:keys [directory relpath] body}
         routing-key (:routing-key metadata)
         exchange (:exchange metadata)
         directory (:directory body)
+        size (get-in body [:entry :stat :st_size])
         relpath (:relpath (:entry body))
         delivery-tag (:delivery-tag metadata)
         fp (string/join File/separator [directory relpath])

    (reap/register-future!
     (future
       (try
         (let [converted (convert fp)]
           (lb/publish ch
                       exchange
                       (routing-key-string-with-command routing-key "import_file")
                       (json/write-str (assoc body "tika-content" converted)))
           (lb/ack ch delivery-tag))
         (catch Exception err
           (logging/info "got exception while handling" fp err)

        ch           (lch/open conn)
        queue-name   (initialize-rabbitmq-structures ch "extract_content" "nextbot" filesystem)]
    (lb/qos ch (+ number-of-cores 4))
    (lcons/blocking-subscribe ch queue-name (partial handle-message options) :auto-ack false)))


(defn run-forever
