Note also that I could be interesting to plug a swank server in a
regular Java app (mainly for dev). This would allow to manipulate you
live app, and use all the Clojure goodness from the confort of your
REPL:
http://denilab.blogspot.fr/2012/04/injecting-clojure-repl-into-your.html

On Fri, May 25, 2012 at 11:34 PM, Karl Krukow <karl.kru...@gmail.com> wrote:

> Thanks Sean for the detailed information. This will be really useful to me.
>
> /Karl
> On 25/05/2012, at 23.30, Sean Corfield wrote:
>
> > On Fri, May 25, 2012 at 1:46 PM, Phil Hagelberg <p...@hagelb.org> wrote:
> >> On Fri, May 25, 2012 at 1:41 PM, Karl Krukow <karl.kru...@gmail.com>
> wrote:
> >>> If I'm embedding swank clojure server in non-development, the code
> would need to start up swank - how would I do that?
> >> Just add swank as a non-dev dependency. The swank-clojure readme
> >> actually covers how to do embedding.
> >
> > Specifically:
> >
> > Add a dependency on [swank-clojure "1.4.2"]
> >
> > Then in your code:
> >
> > (swank.swank/start-server :host "0.0.0.0" :port 4567) ;; use whatever
> > port you want, default is 4005
> >
> > You can programmatically stop the server with:
> >
> > (swank.swank/stop-server)
> >
> > The :host specifies the IP (or hostname) to listen on so if you want
> > external access you'll need to listen on an IP that is externally
> > accessible. If you listen on "0.0.0.0" then it'll listen on any IP
> > address so you can REPL in from outside as well as directly on server
> > itself (on 127.0.0.1). Our servers have multiple IP addresses and this
> > caught me out at first when working with our data center folks and
> > setting up VPN/DMZ access to the host/port.
> >
> > Another thing that was a bit of a problem for us was that swank.swank
> > does a bunch of stuff at initialization that got in our way (I don't
> > remember details) so we actually resolve the symbols at runtime so
> > swank.swank is only loaded when we actually start the swank server:
> >
> > (defn start-swank
> >  "If a swank port is defined for this environment, attempt to start a
> >   swank server on that port. Will throw an exception if it's already
> >   running on that port etc."
> >  []
> >  (require 'swank.swank)
> >  (when-let [start-server (resolve (symbol "swank.swank/start-server"))]
> >    (start-server :host "0.0.0.0" :port (:swank-port @my-settings))))
> >
> > my-settings is a delayed map containing application configuration data
> > (we delay it because the app needs to bootstrap part way in order to
> > read the configuration which gets stored in the map). We use different
> > swank ports on different machines to avoid confusion when
> > slime-connect'ing in from Emacs.
> > --
> > Sean A Corfield -- (904) 302-SEAN
> > An Architect's View -- http://corfield.org/
> > World Singles, LLC. -- http://worldsingles.com/
> >
> > "Perfection is the enemy of the good."
> > -- Gustave Flaubert, French realist novelist (1821-1880)
> >
> > --
> > 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 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 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

Reply via email to