You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because broadcast API is a little too low level to use simply, we need provide NginxPubSubTopic(Java)/PubSubTopic(Clojure) to simplify handling messages among Nginx worker processes.
For Clojure
(defnbuild-topic! [name]
"build a topic".........)
(defprotocolPubSubTopic
(pub! [topic message]
"Publishs a message to the topic")
(sub! [topic att callback]
"Subscribes to a topic and returns an unsubscribing function. When a message comes the callback function will be invoked. e.g. (def my-topic (build-topic! \"my-topic\")) (sub! my-topic (atomic 0) (function [message counter] (println \"received :\" message \", times=\" (swap counter inc)))")
(destory! [topic]
"Destory the topic."))