Hi there, I have a question - I have marked my components with duct/server
but then duct/exec
receives duct/daemon
...does duct/server
derive from duct/daemon
?
Asking because it actually does not seem to launch my servers...if I read the README right it says that they are interchangeable
https://github.com/duct-framework/core/blob/master/src/duct_hierarchy.edn
if you run your app with :duct/daemon
then the :duct/server
keys should start yes
thank @kevin.van.rooijen what if I don't have that file? probably that's were the problem is...
Using lein run
you should have it. Also if you're creating an uberjar you need ["run" ":duct/compiler"]
in your prep-tasks
uhm sorry, that's not correct
I think you need the duct middleware in your project.clj
:middleware [lein-duct.plugin/middleware]
If you're using deps.edn
then you need to do some extra stuff it get it to work. Haven't done it myself but this should help https://github.com/duct-framework/duct/issues/92
Good luck!
One thing I am a bit unfamiliar is the concept of derivation vs composite keys...
If I have something like this in config.edn
: [:duct.server/http :infra2.server/pedestal]
Would that be automatically started?
Cause I am getting a No method in multimethod 'init-key' for dispatch value: :integrant.composite/duct.server.http+infra2.server.pedestal_5851
Do I need to explicitely require the namespaces from my main.clj
?
Basically the way that it works is that a new keyword is created and derived from all the keywords in the vector. https://github.com/weavejester/integrant/blob/b4f77b0fe9618c5d65bf2cafd27510e8e6ba7cdd/src/integrant/core.cljc#L15-L26
You still have to write an ig/init-key
for :infra2.server/pedestal
Duct will try to find an init-key for either keywords, and if it can find 1 it'll initialize it
yep I have that one in place the only missing thing is that it is not required in the main
namespace
In development you mean?
oh
no for prod..
You mean the namespace where the ig/init-key
is defined is not required by main
(sorry I inherited this code base and trying to understand the various moving parts also)
yeah
If the namespace is either: infra2.server.pedestal
or infra2.server
it will automatically be required
Because it matches the name of the init key
But if the namespace has a completely different name, it won't be required automatically
yeah it's exactly infra2.server
containing a ::pedestal
key...strange I got that error
Hmm
Maybe it won't require it if :duct/server
is not derived from :duct/daemon
uhm let me try that then
Because it doesn't need to initialize it
I am trying with [:duct/daemon :infra2.server/pedestal]
I think that should work
No method in multimethod 'init-key' for dispatch value: :integrant.composite/duct.daemon+infra2.server.pedestal_5854
very weird...I'll have to dig into the code base
It should require the namespace even if it doesn't get initialized
Sorry I can't think of a reason why it's not requiring 😅
Unless you're compiling with graalvm
well in that piece of code I can't see how composite keys are required..
anyways I'll dig...thanks a lot for your help