Skip to content

Instantly share code, notes, and snippets.

@AndreasPizsa
Created September 20, 2014 13:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreasPizsa/9f80bea0011518caf340 to your computer and use it in GitHub Desktop.
Save AndreasPizsa/9f80bea0011518caf340 to your computer and use it in GitHub Desktop.
Using the iron_mq node library with Promises
iron_mq = require 'iron_mq'
Promises = require 'bluebird'
Promises.promisifyAll iron_mq.Client.prototype; # here be magick
# Example
imq = new iron_mq.Client
project_id: 'dsdadasdasdas'
token: 'lqwe7skjancc'
queue = imq.queue 'myQueue'
queue.infoAsync() # Append 'Async' for async versions of all methods
.then (data)->
console.info JSON.stringify data
.catch (err)->
console.error JSON.stringify err
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment