thanks for the reply  Erik, that's what I feared, I'm using vertx with the 
ring adapter, basically I do several http async request in my handler and 
I've rewrote  several libs for adapt thes e to vertx, so block my server is 
really bad for me :D ...

http-kit offers an adaptation for ring which handle channel responses 
and https://github.com/mpenet/jet seems do something similar, unfortunately 
vertx doesnt have a big community and could take some time for get this 
adaptations..

seems than I'll need keep using clojure with vertx directly and don't use 
nice libs like compojure,buddy,liberator...that is sad...if you know about 
some small adapter or some code which can I use please let me know...
thanks



El miércoles, 25 de marzo de 2015, 17:29:29 (UTC-4:30), Erik Price escribió:
>
> There is no best approach for this. Yes, you do end up blocking the 
> request thread, but that’s what needs to happen if you the response 
> requires the value returned by the channel. You can’t return a response to 
> the browser and then change it later when the channel sends its value. 
> (You’d have the same problem with Rx, btw.)
>
> The closest equivalent to Rx’s complete event is that a channel is closed 
> (in which case anything blocked or parked on that channel will receive nil
> ).
>
> e
> ​
>
> On Wed, Mar 25, 2015 at 12:08 AM, coco <clasespart...@gmail.com 
> <javascript:>> wrote:
>
>> Hi guys...I've a code similar to this:
>>
>> (defn user-data []
>>   (!/go
>>     (let [a             (!/<! (<fun-async 2))
>>           b              (!/<! (<fun-async a))]
>>       {:response b})))
>>
>> (defn handler-something []
>>   (let [data (!/<!! (user-data))] ;;block here
>>     (print data)
>>     (response  data......)))
>>
>> user-data do a sucession of async calls and return a channel (because 
>> it's inside a go block no?) 
>> my handler-something need extract this data and return it in a ring 
>> response...I can wrap my response function inside a go block, if I do this 
>> I get
>>
>> java.lang.IllegalArgumentException: No implementation of method: :render 
>> of protocol: #'compojure.response/Renderable found for class: 
>> clojure.core.async.impl.channels.ManyToManyChannel
>>
>> so basically I use a block get <!! and then return the data...I'm more 
>> familiar with FRP and in FRP I would use a "onComplete" method which 
>> basically do the same as <!!
>>
>> this pattern is correct or I'll end blocking code?...which could be the 
>> best approach for this?..thanks!
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/d/optout.

Reply via email to