Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (24 sloc) 1.14 KB
(ns co.paralleluniverse.pulsar.examples.cluster.pong
"A distributed version of the classic ping-pong example"
(:use [co.paralleluniverse.pulsar core actors])
(:refer-clojure :exclude [promise await]))
;; This example is intended to be a line-by-line translation of the canonical
;; Erlang [ping-pong example](,
;; so it is not written in idiomatic Clojure.
;; run this with
;; lein with-profile cluster update-in :jvm-opts conj '"-Dgalaxy.nodeId=1"' '"-Dgalaxy.port=7051"' '"-Dgalaxy.slave_port=8051"' -- run -m co.paralleluniverse.pulsar.examples.cluster.pong
;; and after that
;; lein with-profile cluster update-in :jvm-opts conj '"-Dgalaxy.nodeId=2"' '"-Dgalaxy.port=7052"' '"-Dgalaxy.slave_port=8052"' -- run -m
(defsfn pong []
(println "Pong started")
(register! :pong @self)
(loop []
:finished (println "Pong finished")
[:ping ping] (do
(println "Pong received ping")
(! ping :pong)
(defn -main []
(join (spawn pong))
You can’t perform that action at this time.