Re: How do I access components of a system map

2016-01-26 Thread Jo Geraerts
Hey Collin, Op zondag 15 maart 2015 17:26:10 UTC+1 schreef Colin Yates: > > > How do the worker fns actually get called - the dispatching is up to > you - I tend to have a bus (or channel) which is the glue underneath > the gateway. > > For example, I might have: > - a command bus which needs

Re: How do I access components of a system map

2015-03-16 Thread Colin Yates
Glad I could help. On Monday, 16 March 2015 08:02:40 UTC, Torsten Uhlmann wrote: > > Hi Colin, > > the thing I was missing is the entry point into the system, or a way to > get hold of my current component. After re-watching the talk and looking at > the slides ( > http://stuartsierra.com/downlo

Re: How do I access components of a system map

2015-03-16 Thread Torsten Uhlmann
Hi Colin, the thing I was missing is the entry point into the system, or a way to get hold of my current component. After re-watching the talk and looking at the slides (http://stuartsierra.com/download/2014-06-27-components-euroclojure.pdf) I found him mentioning these on slides #94 to #105.

Re: How do I access components of a system map

2015-03-15 Thread Colin Yates
If you haven't already then you might want to watch: https://www.youtube.com/watch?v=13cmHf_kt-Q If it helps: (defn a-real-worker [db] ...) (defrecord ARealWorkerComponent [db registry] components/Lifecycle (start [this] (registry-api/register registry (partial a-real-worker-fn db))

Re: How do I access components of a system map

2015-03-15 Thread Torsten Uhlmann
Colin, thanks for the thoughtful explanation! I still have a problem understanding the flow. Say I want to call a component function (like "get-user") from another component that depends on the database component. I still don't understand how a component function accesses it's dependencies? T

Re: How do I access components of a system map

2015-03-15 Thread Colin Yates
Hi Torsten, It works best when it is all-or-nothing, so the caller of get-user would itself be a component that is dependant upon the db component. The way I visualise it is that the components are a very thin layer at the outer edge of the system that delegate to actual worker functions. Those w

Re: How do I access components of a system map

2015-03-15 Thread Torsten Uhlmann
Hi Walter, thanks for the quick reply. Now, what does the other side of the call look like, where does the caller of "get-user" get the database component from? That's what I don't get. Thanks, Torsten. Am Sonntag, 15. März 2015 16:51:51 UTC+1 schrieb Walter van der Laan: > > Hi, > > This is a

Re: How do I access components of a system map

2015-03-15 Thread Walter van der Laan
Hi, This is an example from http://github.com/stuartsierra/component (defn get-user [database username] (execute-query (:connection database) "SELECT * FROM users WHERE username = ?" username)) Here 'database' is a component which is passed to 'get-user' as an argument. The component

How do I access components of a system map

2015-03-15 Thread Torsten Uhlmann
Hi, I'm tapping my toes in component land and I think I lack some conceptual understanding, probably done too much OO. Please forgive me if this is a stupid question (and I get a feel that it is)... Suppose I create a Lifecycle component with some state, say, a database component that creates