Skip to content

Commit

Permalink
Added usage to README
Browse files Browse the repository at this point in the history
  • Loading branch information
icylisper committed Jan 17, 2010
1 parent b0bf20f commit c049542
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
34 changes: 26 additions & 8 deletions README.md
Expand Up @@ -6,19 +6,37 @@

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:
example/test-connection.clj

To test publishing of messages, run:
example/publisher.clj

2 changes: 1 addition & 1 deletion example/test-connection.clj
Expand Up @@ -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"
Expand Down

0 comments on commit c049542

Please sign in to comment.