I want to add components to a started system, but I'm unsure of a
component-idiomatic way to do that.
I don't want to restart the whole component stack. I'm guessing assoc'ing
a new component to the system-map result isn't a good idea (though I've
read words that sounded like it was a fine thing to do), but then I'd have
a component that hasn't been started residing with other components that
have been started.
I though of adding a static component called akin to a pooling component,
which I would then modify directly in response to my needs, but then I'd
have a mutable component and that isn't particularly desirable either.
For purposes of discussion let's say this is what I want:
(component/system-map
{:connection (make-connection)
:subscriber-1 (component/using (make-subscriber) [:connection])
... more subscribers after starting the system ...
}
)
It isn't a nice prospect to declare all my subscribers at system-map
declaration time or (start) lifecycle time,
I want my system to respond like a service and add new instances of what
are essentially components.
So I either need to graft more components to the resulting system-map, or
make a make a system map entity that is mutable and tracks the pool of
subscribers.
Under this model I'd have
(component/system-map
{:connection (make-connection)
:subscriber-pool (component/using (make-subscriber-pool) [:connection])
})
Then I'd basically have functions to mutate (:subscriber-pool system) by
adding/removing subscribers
Thoughts?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.