Created
September 20, 2014 13:01
-
-
Save AndreasPizsa/9f80bea0011518caf340 to your computer and use it in GitHub Desktop.
Using the iron_mq node library with Promises
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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