1. Alvaro Videla
  2. resizer


Alvaro Videla  committed bda5d6d

switches to new claude version

  • Participants
  • Parent commits 5e8919a
  • Branches master

Comments (0)

Files changed (2)

File src/resizer/consumer.clj

View file
  • Ignore whitespace
         [langohr.consumers :as lhcons]
         [langohr.queue :as lhq]
         [langohr.basic :as lhb]
-        [claude.core :as cf]
-        [resizer.resizer :as rz]))
+        [resizer.resizer :as rz]
+        [resizer.fabric :as rf]))
-(defn rabbitmq-connect []
-  (if (cf/cloudfoundry?)
-    (lhc/connect (lhc/settings-from (cf/rabbit-url)))
-    (lhc/connect)))
-(defonce ^Connection conn (rabbitmq-connect))
+(defonce ^Connection conn (rf/rabbitmq-connect))
 ;; TODO if resize fails publish a message or log that it failed to process the image.
 (defn process-message [ch metadata payload]
   (let [jsondata (read-json (String. payload))
-        filename (:filename jsondata)]
-    (rz/process-image filename)
+        filename (:filename jsondata)
+        mime (:mime jsondata)]
+    (rz/process-image filename mime)
     (lhb/publish ch "cloudstagram-new-image" "" payload :content-type "application/json" )))
 (defn start-consumer []

File src/resizer/resizer.clj

View file
  • Ignore whitespace
 (ns resizer.resizer
   (:require [clojure.string :as cs]
             [monger.core :as mg]
-            [monger.gridfs :as gfs])
-  (:use [monger.gridfs :only [store-file make-input-file filename content-type metadata]]
-        [claude.core :as cf])
+            [monger.gridfs :as gfs]
+            [claude.core :as cf]
+            [claude.mongodb :as cfm])
+  (:use [monger.gridfs :only [store-file make-input-file filename content-type metadata]])
   (:import [java.awt.image BufferedImage]
            [java.io ByteArrayOutputStream]
            [javax.imageio ImageIO]))
 (defn mongo-connect []
   (if (cf/cloudfoundry?)
-    (mg/connect-via-uri! (cf/mongo-url))
+    (mg/connect-via-uri! (cfm/url))
     (mg/connect-via-uri! default-url)))
 (defn get-type [img]