Skip to content

Commit

Permalink
Initial thoughts
Browse files Browse the repository at this point in the history
  • Loading branch information
Almad committed Dec 4, 2013
0 parents commit b8dd94f
Show file tree
Hide file tree
Showing 8 changed files with 192 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

npm-debug.log

/lib
/.idea
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
src/
.git*
.idea
.project

15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js
node_js:
- 0.8
notifications:
email:
recipients:
- lukas@apiary.io
on_success: change
on_failure: always
hipchat:
- secure: "HqBUrmf4P2bgvwb4b9PL1tBae2wcZaXadOgwRwAFhdhDZFHaKXIXlJRUW8tN\ntdO83OZgatxJrpWWQj8VYTfDuhlE3b3NxVWeXc3PkfrHmuvejQf4veh7kwR0\njLVE6jb+ZbFIwRE2W0VFLFKYQHI6PLem4W0OKXW5Shqzy8Ewlow="
irc:
channels: "irc.freenode.org#apiary"
on_success: always
on_failure: always
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(The MIT License)

Copyright (c) 2013 Apiary Inc. <support@apiary.io>.

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.
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## Ivy [![Build Status](https://travis-ci.org/apiaryio/ivy.png?branch=master)](https://travis-ci.org/apiaryio/ivy)

[Ivy](https://github.com/apiaryio/ivy) is [node.js](http://nodejs.org) queue library focused on easy, yet flexible task execution.

Assumptions:

* Shared codebase
* IronMQ (but we want to add other backends)
* Redis for "async task done, resume callback"

Thoughts:

* Provide optimalisation for properly decoupled apps that don't need to overuse subscribeTo + closure

### Installation

Installation is done via NPM, by running ```npm install ivy```

### Features

* Super easy to use


### Quick example

```javascript

var ivy = require('ivy');

var factorial = function factorial(number, callback) {
callback(null, 42);
}

var finished = function resolved(result) {
console.log('result is', result);
}

if (process.env.NODE_ENV==='producer') {
// task must be explicitly registered for now
// we'd like to change that in the future
ivy.registerTask(factorial, {
'name': 'testpackage.factorial',
'queue': 'testpackage' //,
// 'route': 'testpackage.route1',
// 'priority': 0,
// retry: true,
// maxRetries: 10
});

// execute task
ivy.delay(factorial, 5);

}
elseif (process.env.NODE_ENV==='worker') {
ivy.listen({
queue: 'testpackage',

type: 'ironmq',
auth: {
token: process.env.IRONMQ_TOKEN || 'dummy',
project_id: process.env.IRONMQ_PROJECT or 'testpackage'
},

// optional
messages: {
'testpackage.factorial': {
reserveTime: 60*60
}
}

});

}

ivy.pubsub({
'type': 'redis',
'url': 'redis://name:password@hostname:port'
});
```
46 changes: 46 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "ivy
"description": "Queue wrapper with node.js-ish interface.",
"version": "0.0.1",
"author": "Apiary Inc <support@apiary.io>",
"contributors": [
{
"name": "Lukas Linhart",
"email": "lukas@apiary.io"
}
],
"dependencies": {
"async": "",
"aws-sdk": ""
},
"devDependencies": {
"coffee-script": "~1.6.3",
"chai": "",
"mocha": "",
"sinon": ""
},
"keywords": [
"queue"
],
"scripts": {
"prepublish": "scripts/build",
"test": "./node_modules/.bin/mocha --compilers \"coffee:coffee-script\""
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/apiaryio/ivy/blob/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "http://github.com/apiaryio/ivy"
},
"bugs": {
"url": "http://github.com/apiaryio/ivy/issues"
},
"main": "lib/",
"engines": {
"node": "*"
}
}
7 changes: 7 additions & 0 deletions scripts/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

if [ -d "src/" ]; then
rm -fr lib/
node_modules/.bin/coffee -b -c -o lib/ src/
fi

1 change: 1 addition & 0 deletions src/index.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {}

0 comments on commit b8dd94f

Please sign in to comment.