Fork me on GitHub
#core-async
<
2021-05-10
>
itsknk10:05:23

Hey all, what does this mean?

No implementation of method: :put! of protocol: #'clojure.core.async.impl.protocols/WritePort found for class: nil

otfrom10:05:23

looks like you've passed through a nil, when it expected a channel.

itsknk10:05:46

I’m passing it like this:

(>!! (:channel (:com.app.graphql.channel/channel state/system)) {:msg-type :update :data {:msg somevalue}})

itsknk10:05:41

where state/system is integrant.repl.state/system

otfrom10:05:21

I'd check that (:channel (:com.app.graphql.channel/channel state/system)) is returning what you think it is. My guess is that it is nil

💯 6
☝️ 3
itsknk11:05:42

Yeah, added the channel now but

No implementation of method: :put! of protocol: #'clojure.core.async.impl.protocols/WritePort found for class: clojure.lang.PersistentArrayMap                               

raspasov11:05:17

Install timbre

raspasov11:05:20

(>!!
 (timbre/spy
  (:channel (:com.app.graphql.channel/channel state/system))) 
 {:msg-type :update :data {:msg somevalue}})

raspasov11:05:29

Check what it prints

raspasov11:05:35

It’s probably a map now.

itsknk11:05:57

clojure.lang.ExceptionInfo: Invalid Timbre logging level: should be e/o #{:trace :debug :info :warn :error :fatal :report}
    given: {:channel
            #object[clojure.core.async.impl.channels.ManyToManyChannel 0x7ba8e11d "[email protected]"],
            :publication
            #object[clojure.core.async$pub$reify__13166 0x39b5607c "[email protected]"]}
     type: clojure.lang.PersistentArrayMap

raspasov12:05:12

Init somewhere in your project

(timbre/set-level! :trace)

itsknk11:05:05

So what does this mean now?

itsknk11:05:41

This is the channel initialisation:

(defmethod ig/init-key :com.app.graphql.channel/channel [_ _]
  (let [channel (chan)]
    {:channel channel :publication (pub channel :msg-type)}))

itsknk11:05:08

(>!! channel {:msg-type :update :data {:msg value}}) putting data inside it like this

raspasov12:05:19

This code is out of context. It’s not possible to see where/how you’re calling (>!! channel …).

otfrom14:05:07

@kishore.karnam do you have other core.async code working? These examples take a fair bit to pick through

otfrom14:05:55

it looks like you need to check your code again after setting up timbre correctly as per https://clojurians.slack.com/archives/C05423W6H/p1620649512148300?thread_ts=1620645717.146000&amp;cid=C05423W6H

itsknk15:05:55

It should be (>!! (:channel channel) {:msg-type :update :data {:msg value}})) because :com.app.graphql.channel/channel is returning a map

otfrom15:05:56

glad you got it sorted. Happy coding

🎉 3