Fork me on GitHub
#duct
<
2021-02-25
>
richiardiandrea19:02:54

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

richiardiandrea19:02:34

thank @UG9U7TPDZ what if I don't have that file? probably that's were the problem is...

Kevin19:02:11

Using lein run you should have it. Also if you're creating an uberjar you need ["run" ":duct/compiler"] in your prep-tasks

Kevin19:02:44

uhm sorry, that's not correct

Kevin19:02:01

I think you need the duct middleware in your project.clj :middleware [lein-duct.plugin/middleware]

richiardiandrea19:02:17

uhm ok - I am using deps.edn but that's ok - I somehow assumed by the README that the derivation was implicit - thanks again!

Kevin19:02:03

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

Kevin19:02:14

Good luck!

richiardiandrea19:02:38

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?

Kevin19:02:36

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

Kevin19:02:08

You still have to write an ig/init-key for :infra2.server/pedestal

Kevin19:02:36

Duct will try to find an init-key for either keywords, and if it can find 1 it'll initialize it

richiardiandrea19:02:43

yep I have that one in place the only missing thing is that it is not required in the main namespace

Kevin19:02:04

In development you mean?

Kevin19:02:33

You mean the namespace where the ig/init-key is defined is not required by main

richiardiandrea19:02:38

(sorry I inherited this code base and trying to understand the various moving parts also)

Kevin19:02:15

If the namespace is either: infra2.server.pedestal or infra2.server it will automatically be required

Kevin19:02:39

Because it matches the name of the init key

Kevin19:02:24

But if the namespace has a completely different name, it won't be required automatically

richiardiandrea19:02:27

yeah it's exactly infra2.server containing a ::pedestal key...strange I got that error

Kevin19:02:42

Maybe it won't require it if :duct/server is not derived from :duct/daemon

richiardiandrea19:02:53

uhm let me try that then

Kevin19:02:57

Because it doesn't need to initialize it

richiardiandrea19:02:29

I am trying with [:duct/daemon :infra2.server/pedestal]

Kevin19:02:49

I think that should work

richiardiandrea19:02:06

No method in multimethod 'init-key' for dispatch value: :integrant.composite/duct.daemon+infra2.server.pedestal_5854

richiardiandrea19:02:23

very weird...I'll have to dig into the code base

Kevin19:02:35

It should require the namespace even if it doesn't get initialized

Kevin19:02:54

Sorry I can't think of a reason why it's not requiring 😅

Kevin19:02:01

Unless you're compiling with graalvm

richiardiandrea19:02:21

well in that piece of code I can't see how composite keys are required..

richiardiandrea20:02:33

anyways I'll dig...thanks a lot for your help

Kevin19:02:53

if you run your app with :duct/daemon then the :duct/server keys should start yes

richiardiandrea19:02:17

uhm ok - I am using deps.edn but that's ok - I somehow assumed by the README that the derivation was implicit - thanks again!