Out of frustration, I have decided to surpress the re-tries. This
worries me -- I hate to bury a problem without understanding it. But
the retries are burying the actual queries. This page:

https://github.com/dakrone/clj-http

says:

;; Apache's http client automatically retries on IOExceptions, if you
;; would like to handle these retries yourself, you can specify a
;; :retry-handler. Return true to retry, false to stop trying:
(client/post "http://example.org"; {:multipart [["title" "Foo"]
                                               ["Content/type" "text/
plain"]
 
["file" (clojure.java.io/file "/tmp/missing-file")]]
                                   :retry-handler (fn [ex try-count
http-context]
                                                    (println "Got:"
ex)
                                                    (if (> try-count
4) false true))})

So I have re-written my function so that the re-tries are always
suppressed:


(defn omniture-call-api [url-with-queue-method api-payload headers]
  (timbre/spy :debug " return value of omniture-call-api "
              (try+
                (http-client/post url-with-queue-method
                                  {:body api-payload
                                   :debug true
                                   :debug-body true
                                   :insecure true
                                   :headers {"X-Api-Version" "2"
                                             "X-WSSE" headers}
                                   :content-type :json
                                   :socket-timeout 4000
                                   :conn-timeout 4000
                                   :accept :json
                                   :client-params
{"http.protocol.allow-circular-redirects" false
                                                   "http.useragent"
"clj-http"}
                                   :retry-handler (fn [ex try-count
http-context]
                                                    false)
                                   })
                (catch Object o (catch-clj-http-exceptions o)))))


I will have to come back to this later, when I have more time, and try
to figure out what is going wrong.



On Mar 5, 2:19 pm, larry google groups <lawrencecloj...@gmail.com>
wrote:
> This is strange. An IOException is thrown, but it seems to do with
> with the retry, which should never exist in the first place, unless an
> IOException has been thrown:
>
>  clj-http has thrown this exception:
> {:trace-redirects
>  ["https://api2.omniture.com/admin/1.3/rest/?
> method=Report.QueueOvertime"],
>  :request-time 885,
>  :status 401,
>  :headers
>  {"date" "Tue, 05 Mar 2013 19:14:46 GMT",
>   "server" "Omniture AWS/2.0.0",
>   "www-authenticate"
>   "WSSE realm=\"Omniture REST Api\", profile=\"UsernameToken\"",
>   "xserver" "www811",
>   "content-length" "90",
>   "content-type" "application/json",
>   "connection" "close"},
>  :body
>  "{\"error\":\"The nonce
> (NGQ1ODc4NmU3M2QyY2I5MmIyOTIzOWFiN2Q4ODc1NjQ=) has already been used
> \"}"}
>
> On Mar 5, 12:45 pm, larry google groups <lawrencecloj...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > > silly question are you using the call in a sequence pipeline with pmap or
> > > mapcat or the like? Or does clj-http that under the covers?
>
> > Those are good questions. Until I get this working I have been doing
> > the simplest thing possible, which is simply starting the app, and
> > then having the app make the call to Omniture as one of the first
> > things it does on startup.
>
> > I will dig into clj-http to see what it is doing under the covers.
>
> > I am curious, do you have a suspicion about something? A theory?
>
> > On Mar 5, 11:17 am, "Meikel Brandmeyer (kotarak)" <m...@kotka.de>
> > wrote:
>
> > > Hi,
>
> > > silly question are you using the call in a sequence pipeline with pmap or
> > > mapcat or the like? Or does clj-http that under the covers?
>
> > > Kind regards
> > > Meikel

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to