Permalink
Browse files

Merge branch 'release/0.1.0'

  • Loading branch information...
2 parents 8b0a679 + d58d1ec commit 74c524b49c37c7b7a4f5bac28023e30dd5510ee8 @FGRibreau committed Dec 1, 2011
View
@@ -0,0 +1,8 @@
+# node
+node_modules
+
+*.rdb
+*.log
+
+# mac
+DS_STORE
View
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.4
+ - 0.6
View
@@ -0,0 +1,21 @@
+{spawn, exec} = require 'child_process'
+
+task 'build', 'continually build the amqp-dsl library with --watch', ->
+ coffee = spawn 'coffee', ['-cw', '-o', 'lib', 'src']
+ coffee.stdout.on 'data', (data) -> console.log data.toString().trim()
+
+task 'install', 'install dependencies', ->
+ npm = spawn 'npm', ['install']
+ npm.stdout.on 'data', (data) -> console.log data.toString().trim()
+
+task 'doc', 'rebuild the documentation', ->
+ exec([
+ 'rm -r docs'
+ './node_modules/docco/bin/docco src/*.coffee examples/*.coffee'
+ ].join(' && '), (err) ->
+ throw err if err
+ )
+
+task 'test', 'run tests', ->
+ npm = spawn 'npm', ['test']
+ npm.stdout.on 'data', (data) -> console.log data.toString().trim()
View
27 LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2011, Francois-Guillaume Ribreau <node@fgribreau.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of amqp-dsl nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
122 README.md
@@ -0,0 +1,122 @@
+## Fluent Interface for dealing with AMQP on NodeJS [![Build Status](https://secure.travis-ci.org/FGRibreau/node-amqp-dsl.png)](http://travis-ci.org/FGRibreau/node-amqp-dsl) ##
+
+AMQP-DSL is a [fluent interface](http://en.wikipedia.org/wiki/Fluent_interface) wrapper for [node-amqp](https://github.com/postwait/node-amqp) and help you write AMQP binding code in a clean and efficient way.
+
+## Installation
+
+ $ npm install amqp-dsl
+
+## Usage overview
+
+### Simple connection (more details: `docs/example-connection`)
+
+```coffeescript
+
+amqp = require 'amqp-dsl'
+
+amqp.login(
+
+ login: 'user'
+ password: 'password'
+ host: 'localhost'
+
+).connect((err, amqp) ->
+
+ if err
+ throw err
+ return
+
+ console.log 'We are connected !'
+
+)
+```
+
+### Simple example (more details: `docs/example-simple`)
+
+```coffeescript
+
+AmqpDsl = require 'amqp-dsl'
+
+AmqpDsl.login(
+ login: 'legen'
+ password: 'dary'
+)
+.on( 'close', () -> console.error "RabbitMQ connection closed" )
+.on( 'error', (err) -> console.error "RabbitMQ error", err )
+.on( 'ready', () -> console.log "Connected to RabbitMQ" )
+
+.queue( 'testQueue', (queue) -> console.log "Connected to Queue", queue.name )
+ .bind( 'stream', '#' )
+ .subscribe( (message, header, deliveryInfo) -> )
+
+.queue( 'queue2' )
+ .bind( 'search', '#.ok' )
+
+.queue( 'queue3', passive:true )
+
+.connect( (err, amqp) ->
+
+ if err
+ throw err
+ return
+
+ # Do other stuff with `amqp` like subscribing to a queue
+
+ queue3 = amqp.queues.queue3
+
+ queue3.subscribe( ack:true, ( message, header, deliveryInfo ) ->
+ console.log "Hey ! We got one new message !"
+ queue3.shift()
+ )
+
+)
+```
+
+See `examples/` and `docs/` for more information.
+
+## API
+
+### .login
+ * `login( options = {} )`
+
+### .on
+ * `on( event, listener )`
+
+### .exchange
+ * `.exchange( name, options )`
+ * `.exchange( name, callback(exchange) )`
+ * `.exchange( name, options, callback(exchange) )`
+
+### .queue
+ * `.queue( name, options )`
+ * `.queue( name, callback(queue) )`
+ * `.queue( name, options, callback(queue) )`
+
+### .queue(...).subscribe
+ * `.subscribe( callback(message, header, deliveryInfo) )`
+ * `.subscribe( options, callback(message, header, deliveryInfo) )`
+
+### .queue(...).bind
+ * `.bind( name, routingKey )`
+
+### .connect
+ * `.connect( amqp, callback(err, amqp) )`
+ * `.connect( callback(err, amqp) )`
+
+The `amqp` argument is simply hashtable with the following properties:
+
+ * queues (hashtable of `AMQP::queues`)
+ * exchanges (hashtable of `AMQP::Exchange`)
+ * connection (`AMQP::Connection`)
+
+
+## Documentation
+
+### Build documentation
+ $ cake doc
+
+... and browse `docs/`
+
+## Test
+
+ $ npm test
Oops, something went wrong.

0 comments on commit 74c524b

Please sign in to comment.