Skip to content

Commit

Permalink
Updated the readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damon Snyder committed Dec 29, 2010
1 parent 298aa2c commit 4123193
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 15 deletions.
15 changes: 0 additions & 15 deletions README

This file was deleted.

55 changes: 55 additions & 0 deletions README.markdown
@@ -0,0 +1,55 @@
# beanstalk

A native clojure [beanstalkd](http://kr.github.com/beanstalkd/) client library.
Some inspiration and ideas were taken from [cl-beanstalk](https://github.com/antifuchs/cl-beanstalk/).

## Usage

The beanstalk client uses deftype and a protocol declaration to create a simple
(socket, reader, writer) tuple. The protocol defines methods that are direct
mappings to the [beanstalk protocol commands](https://github.com/kr/beanstalkd/blob/v1.3/doc/protocol.txt).
For example:

; producer
user=> (def b (new-beanstalk))
user=> (.use b "my-tube")
user=> (.put b 0 0 0 5 "hello")
...
; consumer
user=> (def b (new-beanstalk))
user=> (.watch b "my-tube")
user=> (def job (.reserve b)) ; id is (:id job), payload is (:payload job)

## Examples

Two examples are provided:

; start consumer
lein run -m beanstalk.examples.consumer

; send some data
lein run -m beanstalk.examples.producer -m "hello" -n 5
; send shutdown
lein run -m beanstalk.examples.producer -m "exit"

## License

Copyright (c) 2010 Damon Snyder

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 1 addition & 0 deletions project.clj
Expand Up @@ -2,6 +2,7 @@
:description "FIXME: write"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]]
:dev-dependencies [[lein-clojars "0.5.0-SNAPSHOT"]]
; :main [namespace.with.main]
; :run-aliases {:one another.namespace :two yet.another.namespace}
)
1 change: 1 addition & 0 deletions src/beanstalk/examples/consumer.clj
@@ -1,5 +1,6 @@
(ns beanstalk.examples.consumer
(:gen-class)
(:refer-clojure :exclude [read peek use])
(:use clojure.contrib.command-line)
(:use beanstalk.core))

Expand Down
1 change: 1 addition & 0 deletions src/beanstalk/examples/producer.clj
@@ -1,5 +1,6 @@
(ns beanstalk.examples.producer
(:gen-class)
(:refer-clojure :exclude [read peek use])
(:use clojure.contrib.command-line)
(:use beanstalk.core))

Expand Down

0 comments on commit 4123193

Please sign in to comment.