This project is under development
Clojure client for Liftbridge, a system that provides lightweight, fault-tolerant message streams for NATS.
Liftbridge provides the following high-level features:
(require '[com.caioaao.clj-liftbridge.client :as lift])
(import '[io.grpc ManagedChannelBuilder])
;; create the gRPC channel to connect to Liftbridge API
(def grpc-channel (->> (ManagedChannelBuilder/forAddress server-ip server-port)
.usePlaintext
.build))
;; Create Liftbridge client.
(def lift-client (lift/connect grpc-channel))
;; Create a stream named `foo`
@(lift/create-stream lift-client "foo" {})
;; publish a message to "foo-stream"
(lift/publish lift-client "foo" (.getBytes "hello"))
;; subscribe to the stream starting from the beginning.
(def ch (lift/subscribe lift-client "foo" {:start-at :liftbridge.start-at/earliest-received}))
;; get messages from the channel returned by the subscription function
(require '[clojure.core.async :refer [<!!]])
(println (<!! ch))
;; cleanup
(.shutdown grpc-channel)
For more information, see the API docs.
publish
high level API (on hold - see liftbridge-io/liftbridge-api#10)Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close