npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

amqp-dsl

v2.0.2

Published

Amqp-DSL - Fluent interface for node-amqp

Downloads

32

Readme

Fluent Interface for dealing with AMQP on NodeJS Build Status

AMQP-DSL is a fluent interface wrapper for 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)


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)


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', '#' )
  .bind( 'stream2', 'routing.key' )
  .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()
  • .connect( callback(err, amqp) )
  • .connect( amqp, 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

Release History

v2.0.0 - Updated node-amqp to 0.2.0 and async to 0.9.0 v1.0.3 - Support for .connect() v1.0.2 - Critical bug fix v1.0.1 - .bind & .subscribe can now be called multiple times. This is the behavior that should have been in place since the beginning.

Donate

Donate Bitcoins

License

Copyright (c) 2014 Francois-Guillaume Ribreau Licensed under the MIT license.