From c0495421ecc78478b2e507233a279f7dc1995433 Mon Sep 17 00:00:00 2001 From: Isaac Praveen Abraham Date: Sun, 17 Jan 2010 19:00:40 +0530 Subject: [PATCH] Added usage to README --- README.md | 34 ++++++++++++++++++++++++++-------- example/test-connection.clj | 2 +- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1e1a505..5abbd32 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,33 @@ lein deps - -## Usage and API ## +## API ## + +Add [clojure-rabbitmq "0.2.1"] to the dependencies list in your project.clj + + (ns rabbitmq-publisher-test + (:require [org.clojars.rabbitmq :as rabbitmq])) + + (defonce conn-map {:username "guest" + :password "guest" + :host "localhost" + :port 5672 + :virtual-host "/" + :type "direct" + :exchange "sorting-room" + :queue "po-box" + :durable true + :routing-key "tata"}) + (defonce connection (connect conn-map)) + (let [[conn channel] connection] + (do + (rabbitmq/bind-channel conn-map channel) + (println "rabbitmq publishing:" (format "message%d" @c)) + (rabbitmq/publish conn-map channel (format "message%d" @c)))) + + +## Examples ## - add below to the dependencies list in your project.clj - - [clojure-rabbitmq "0.2.1"] - - See `example/publisher.clj` and `example/consumer.clj` for usage. To test connection to the rabbitmq server, run: @@ -21,4 +40,3 @@ To test connection to the rabbitmq server, run: To test publishing of messages, run: example/publisher.clj - diff --git a/example/test-connection.clj b/example/test-connection.clj index f3c7a76..4ab5efd 100755 --- a/example/test-connection.clj +++ b/example/test-connection.clj @@ -3,7 +3,7 @@ exec java -cp "lib/*:$PWD/*" clojure.main "$0" -- "$@" ] -(use 'org.clojars.rabbitmq) + (use 'org.clojars.rabbitmq) ;; example(1) (defonce conn-map {:username "guest"