Google Groups

Re: [vertx:9317] current state of Clojure support


Tim Fox Jun 11, 2013 8:08 AM
Posted in group: vert.x
I've wanted Clojure support for a long time (it's a similar story with
Scala), but no-one in the vert.x core team has the Clojure skills (or
the time right now) to do this.

So it's really up to some-one in the Vert.x community to take up the
task and drive it through to completion.

Matt and Norman did a great job in starting this effort, but it's always
the last part that's the hardest.

So, if anyone out there would like to kick some life back into it,
please go ahead!

On 11/06/13 15:39, Bruno Bonacci wrote:
> Hi,
>
> I'm interested in the Clojure bindings as well. Is there anything happening
> on this side?
>
> Bruno
>
> On Tuesday, June 11, 2013 6:21:24 AM UTC+1, NovaNick wrote:
>> Bumping for clojure.
>> Looks like Matt and Norman were able to make some progress here, and the
>> git doesn't show any activity since. Is there any new activity on clojure
>> integration activity happening off-list? Seems like there's a foundation to
>> build on here.
>>
>> On Tuesday, November 13, 2012 5:29:31 AM UTC-8, 2tothe8th wrote:
>>> What is the progress on this?  I'm currently waiting on Clojure support
>>> to determine if the company I work for can use vert.x.  Thanks.
>>>
>>> On Wednesday, October 24, 2012 10:19:59 AM UTC-4, Norman Richards wrote:
>>>> On Fri, Oct 5, 2012 at 12:20 PM, Norman Richards <o...@nostacktrace.com>
>>>> wrote:
>>>>> This might be a productive approach.  I've started from the current
>>>> master:
>>>>> https://github.com/orb/vert.x/tree/clojure
>>>>>
>>>>> It doesn't do anything clojure yet except recognize .clj files.  I
>>>>> suspect I should be able to get some kind of minimal clojure code
>>>>> running over the weekend.
>>>> Wanted to follow up on this for those who are interested.  I have
>>>> working clojure integration on my branch and I've ported most of the
>>>> examples.  My approach so far has been to focus on the clojure java
>>>> interop and slowly introduce abstractions/syntax as they are needed.
>>>> This doesn't make for the most beautiful of clojure yet, but it's
>>>> allowed me to productively use clojure with vertx on a prototype app
>>>> I'm doing for a client.
>>>>
>>>> Here's a few examples.  I've introduced macros for event result
>>>> handlers and some more specific macros for doing redis using
>>>> modmod-redis.  Threading and doto aren't too bad.  It's quite usable
>>>> now, so with a little more work it ought to be pretty nice.
>>>>
>>>>
>>>> (defhandle not-found [_ request]
>>>>    (doto (. request response)
>>>>      (content-type "text/html; charset=UTF-8")
>>>>      (status-code 404)
>>>>      (.end  "<html><body><h1>Not Found</h1></body></html>")))
>>>>
>>>>
>>>> (def routes
>>>>    (doto (new org.vertx.java.core.http.RouteMatcher)
>>>>      (.get "/" list-sessions)
>>>>      (.get "/stats" list-sessions)
>>>>      (.get "/stats/:user" list-user-sessions)
>>>>      (.get "/stats/:user/:villain" show-stats)
>>>>      (.noMatch not-found)))
>>>>
>>>>
>>>> (defhandle main [this deployment-id]
>>>>      (doto (.createHttpServer vertx)
>>>>        (.requestHandler routes)
>>>>        (.listen 8080)))
>>>>
>>>> (-> container
>>>>      (deployModule "de.marx-labs.redis-client-v0.3" redis-conf 1 main))
>>>>
>>>>
>>>> (-> container
>>>>      (deployModule "de.marx-labs.redis-client-v0.3" redis-conf 1
>>>>                    (handle [this deployment-id]
>>>>                      (.setPeriodic vertx 5000 poll-incoming)
>>>>                      (.setPeriodic vertx 5000 poll-queues))))
>>>>
>>>>
>>>> (defn send-to-queue [hand-id player1 player2]
>>>>    (let [session-key (str "session:" player1 ":" player2)]
>>>>      (if-exists session-key
>>>>                 (let [queue-key (str "queue:" player1 ":" player2)]
>>>>                   (redis-lpush queue-key hand-id
>>>>                                (with-redis-response r
>>>>                                  (println "LPUSH" queue-key r)))))))
>>>>