File tree Expand file tree Collapse file tree 5 files changed +97
-0
lines changed
Expand file tree Collapse file tree 5 files changed +97
-0
lines changed Original file line number Diff line number Diff line change 1+ /target
2+ /lib
3+ /classes
4+ /checkouts
5+ pom.xml
6+ pom.xml.asc
7+ * .jar
8+ * .class
9+ .lein- *
10+ bin /*
Original file line number Diff line number Diff line change 1+ # Clojure code for RabbitMQ tutorials
2+
3+ Here you can find Ruby code examples from
4+ [ RabbitMQ tutorials] ( http://www.rabbitmq.com/getstarted.html ) .
5+
6+ ## Requirements
7+
8+ To run this code you need [ Langohr] ( http://clojurerabbitmq.info ) .
9+
10+ Dependencies are managed by [ Leiningen] ( http://leiningen.org ) .
11+
12+ These tutorials only require JDK 6 or 7 (Oracle or OpenJDK).
13+
14+ ## Code
15+
16+ Code examples are executed via ` lein run ` :
17+
18+ [ Tutorial one: "Hello World!"] ( http://www.rabbitmq.com/tutorial-one-java.html ) :
19+
20+ lein run -m "rabbitmq.tutorials.send"
21+ lein run -m "rabbitmq.tutorials.receive"
22+
23+ [ Tutorial two: Work Queues] ( http://www.rabbitmq.com/tutorial-two-java.html ) :
24+
25+ lein run -m "rabbitmq.tutorials.new-task"
26+ lein run -m "rabbitmq.tutorials.worker"
27+
28+ [ Tutorial three: Publish/Subscribe] ( http://www.rabbitmq.com/tutorial-three-java.html )
29+
30+ ruby receive_logs.rb
31+ ruby emit_log.rb
32+
33+ [ Tutorial four: Routing] ( http://www.rabbitmq.com/tutorial-four-java.html )
34+
35+ ruby receive_logs_direct.rb
36+ ruby emit_log_direct.rb
37+
38+ [ Tutorial five: Topics] ( http://www.rabbitmq.com/tutorial-five-java.html )
39+
40+ ruby receive_logs_topic.rb
41+ ruby emit_log_topic.rb
42+
43+ [ Tutorial six: RPC] ( http://www.rabbitmq.com/tutorial-six-java.html )
44+
45+ ruby rpc_server.rb
46+ ruby rpc_client.rb
47+
48+ To learn more, visit [ Langohr documentation] ( http://clojurerabbitmq.info ) site.
Original file line number Diff line number Diff line change 1+ (defproject com.rabbitmq /tutorials " 1.0.0-SNAPSHOT"
2+ :description " RabbitMQ tutorials using Langohr"
3+ :url " http://github.com/rabbitmq/rabbitmq-tutorial"
4+ :license {:name " Eclipse Public License"
5+ :url " http://www.eclipse.org/legal/epl-v10.html" }
6+ :dependencies [[org.clojure/clojure " 1.5.1" ]
7+ [com.novemberain/langohr " 1.3.0" ]])
Original file line number Diff line number Diff line change 1+ (ns rabbitmq.tutorials.receive
2+ (:require [langohr.core :as lc]
3+ [langohr.channel :as lch]
4+ [langohr.queue :as lq]
5+ [langohr.consumers :as lcons]))
6+
7+ (defn handle-delivery
8+ " Handles message delivery"
9+ [ch metadata payload]
10+ (println (format " [x] Received %s" (String. payload " UTF-8" ))))
11+
12+ (defn -main
13+ [& args]
14+ (with-open [conn (lc/connect )]
15+ (let [ch (lch/open conn)]
16+ (lq/declare ch " hello" :durable false :auto-delete false )
17+ (println " [*] Waiting for messages. To exit press CTRL+C" )
18+ (lcons/blocking-subscribe ch " hello" handle-delivery :auto-ack true ))))
Original file line number Diff line number Diff line change 1+ (ns rabbitmq.tutorials.send
2+ (:require [langohr.core :as lc]
3+ [langohr.channel :as lch]
4+ [langohr.queue :as lq]
5+ [langohr.basic :as lb]))
6+
7+
8+ (defn -main
9+ [& args]
10+ (with-open [conn (lc/connect )]
11+ (let [ch (lch/open conn)]
12+ (lq/declare ch " hello" :durable false :auto-delete false )
13+ (lb/publish ch " " " hello" (.getBytes " Hello World!" " UTF-8" ))
14+ (println " [x] Sent 'Hello World!'" ))))
You can’t perform that action at this time.
0 commit comments