A batch publisher for Google Cloud PubSub.
(require '[cloud-pubsub-batch-publisher.core :as pubsub])
(def publisher (pubsub/publisher "TOPIC-NAME")
;; In a single publish request, all messages must have no ordering key
;; or they must all have the same ordering key.
;; See https://cloud.google.com/pubsub/docs/ordering
(def messages
[{:message "MESSAGE" ;; String, required
:metadata {"KEY" "VALUE"} ;; Map<String, String>, optional
:ordering-key "KEY"}]) ;; String, optional
(pubsub/publish! publisher {:messages messages})
(pubsub/shutdown! publisher {:await-msec 1000})
Copyright © 2021 Haokang Den
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close