Re: Help needed with Component library

2015-02-10 Thread Gilberto Garcia
You nailed it Steve. thanks for the insight :) On Tue, Feb 10, 2015 at 12:13 PM, Steve Ashton wrote: > In main.clj, it looks like you aren't keeping a reference to the started > app. So when you call stop, you are actually stopping the version of the > system which doesn't have the jetty server

Re: Help needed with Component library

2015-02-10 Thread James Reeves
On 10 February 2015 at 11:36, wrote: > > I also do (assoc this :jetty nil) instead of (dissoc this :jetty-server) > as the dissoc will stop it being a defrecord. > dissoc only turns the record into a map if you remove one of its core fields: user=> (defrecord Foo [x]) user.Foo user=> (def f (m

Re: Help needed with Component library

2015-02-10 Thread guy . barlow
Hi, I've been messing around with the component library too recently, It's probably worth printing out the defrecord (the Ring one) to see if the values are being populated by the start function. You could just do this in the repl using clojure/pprint.pprint. I also do (assoc this :jetty nil)

Re: Help needed with Component library

2015-02-10 Thread Steve Ashton
In main.clj, it looks like you aren't keeping a reference to the started app. So when you call stop, you are actually stopping the version of the system which doesn't have the jetty server set. Try changing this: (defn -main [& args] (component/start app) (component/stop app)) to this: (de

Re: Help needed with Component library

2015-02-10 Thread Gilberto Garcia
I get the same error because the key :jetty-server = nil so, (:jetty-server this) will return nil what turns into (.stop nil) note that if I print 'this' after assoc'ing :jetty-server in the start lifecycle I see the jetty server associated with the key :jetty-server for some reason I'm loosing t

Re: Help needed with Component library

2015-02-10 Thread Chris Ford
What happens if you try: (.stop (:jetty-server this)) instead of: (.stop jetty-server) I'm not at a repl right now, but maybe your stop method is closing over the value of jetty-server that's passed in when the record was constructed? On 10 February 2015 at 22:58, Gilberto Garcia wrote: > He

Re: Help needed with Component library

2015-02-10 Thread Gilberto Garcia
Here it goes https://gist.github.com/ggarciajr/e5f1c0f1072c63705ac4 Note that the :jetty-server is nil and it should hold the jetty server so it can be stopped in the stop phase. #toro_tokens_rest.components.ring.Ring{:port 3000, :database #toro_tokens_rest.components.database.Database{:path /tmp

Re: Help needed with Component library

2015-02-10 Thread Chris Ford
Perhaps it would help if you posted a gist of the stacktrace you encounter? On 10 February 2015 at 20:29, Gilberto Garcia wrote: > Hi All, > > I'm new to clojure and I'm trying to create a simple rest api to create > and manages to token. > I'm trying to use Stuart's component library but I'm ha