core-async

itsknk 2021-05-10T10:10:23.140600Z

Hey all, what does this mean?

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

2021-05-10T10:18:23.141500Z

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

itsknk 2021-05-10T10:19:46.142Z

I’m passing it like this:

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

itsknk 2021-05-10T10:20:41.142400Z

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

2021-05-10T10:38:21.142800Z

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

💯 2
☝️ 1
itsknk 2021-05-10T11:10:42.144200Z

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                               

raspasov 2021-05-10T11:15:17.145Z

Install timbre

raspasov 2021-05-10T11:15:20.145200Z

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

raspasov 2021-05-10T11:15:29.145500Z

Check what it prints

raspasov 2021-05-10T11:15:35.145700Z

It’s probably a map now.

itsknk 2021-05-10T11:21:57.146Z

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 "clojure.core.async.impl.channels.ManyToManyChannel@7ba8e11d"],
            :publication
            #object[clojure.core.async$pub$reify__13166 0x39b5607c "clojure.core.async$pub$reify__13166@39b5607c"]}
     type: clojure.lang.PersistentArrayMap

itsknk 2021-05-10T11:22:05.146300Z

So what does this mean now?

itsknk 2021-05-10T11:22:41.146700Z

This is the channel initialisation:

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

itsknk 2021-05-10T11:23:08.147200Z

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

raspasov 2021-05-10T12:25:12.148300Z

Init somewhere in your project

(timbre/set-level! :trace)

raspasov 2021-05-10T12:25:19.148500Z

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

2021-05-10T14:40:07.150900Z

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

2021-05-10T14:40:55.151400Z

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&cid=C05423W6H

itsknk 2021-05-10T15:48:55.151700Z

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

2021-05-10T15:49:50.151900Z

🆒

2021-05-10T15:49:56.152200Z

glad you got it sorted. Happy coding

🎉 1