Fork me on GitHub
#graphql
<
2018-01-31
>
gklijs05:01:00

I have a problem getting subscriptions to work, right now the schema compiles, but I don’t hit the code supplied by util/attach-streamers. I have a definition in my schema like

:subscriptions
 {
  :stream_transactions
  {:type        :Transaction
   :description "Get transactions as they happen, with optional filtering"
   :args        {:iban       {:type        String
                              :description "optional filter on matching iban"}
                 :min_amount {:type        Int
                              :description "optional filter based on transferred amount"}
                 :direction  {:type        :dtype
                              :description "optional filter on DEBIT or CREDIT"}}
   :stream      :stream-transactions}}

gklijs05:01:14

replaced in the stream map by a function:

(defn stream-map
  [component]
  (let [db (:db component)]
    {:stream-transactions     (stream-transactions db)
     }))

gklijs05:01:43

But the function isn’t called, but maybe I enter the wrong thing in Graphiql, I tried it with

subscription{
  stream_transactions (iban: "cash" direction: "DEBIT" min_amount: 10){
    id
    iban
  }
}
and in graphiql that goed fine, but it’s not hitting the code to generate the subscription.

gklijs06:01:36

Seems like I need to add some configuration to pedestal to make subscriptions work.

gklijs06:01:39

It's called now:slightly_smiling_face:

gklijs08:01:25

And now it's working. I will probably by open sourcing all or some of the code I have. It's turned out quite easy to expose Kafka as graphql