Skip to content

Commit

Permalink
Merge branch 'release/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
davesag committed Jan 28, 2019
2 parents dfab1c0 + b9e280f commit 2c2a0b8
Show file tree
Hide file tree
Showing 12 changed files with 139 additions and 99 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ A very simplistic, but performant, remote worker system that uses AMQP to coordi
| `develop` | [![CircleCI](https://circleci.com/gh/davesag/amqp-delegate/tree/develop.svg?style=svg)](https://circleci.com/gh/davesag/amqp-delegate/tree/develop) | [![codecov](https://codecov.io/gh/davesag/amqp-delegate/branch/develop/graph/badge.svg)](https://codecov.io/gh/davesag/amqp-delegate) | Work in progress |
| `master` | [![CircleCI](https://circleci.com/gh/davesag/amqp-delegate/tree/master.svg?style=svg)](https://circleci.com/gh/davesag/amqp-delegate/tree/master) | [![codecov](https://codecov.io/gh/davesag/amqp-delegate/branch/master/graph/badge.svg)](https://codecov.io/gh/davesag/amqp-delegate) | Latest stable release |

```
npm install amqp-delegate
```

## Worker

```
Expand Down Expand Up @@ -43,7 +47,6 @@ worker.stop().then(() => {
const { makeDelegator } = require('amqp-delegate')
const delegator = makeWorker({
exchange: <the name of the exchange to use> — defaults to '',
url: <the url of the amqp server> - defaults to ampq://localhost,
onError: err => { // optional
console.error('A connection error happened', err) // or do something clever
Expand All @@ -69,6 +72,8 @@ delegator
### The worker

```
const { makeWorker } = require('amqp-delegate')
const task = (a, b) =>
new Promise(resolve => setTimeout(() => resolve(a + b), 10))
Expand Down Expand Up @@ -96,6 +101,8 @@ worker
### The delegator

```
const { makeDelegator } = require('amqp-delegate')
const delegator = makeDelegator()
delegator
Expand All @@ -109,11 +116,6 @@ delegator
})
```

## TODO

* documentation
* publish to npm

## Development

### Prerequisites
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ volumes:

services:
amqp:
image: rabbitmq
image: rabbitmq:management-alpine
ports:
- 15672:15672
- 5672:5672
Expand Down
122 changes: 60 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"name": "amqp-delegate",
"version": "1.0.0",
"version": "1.0.1",
"description": "A very simplistic, but performant, remote worker system that uses AMQP to coordinate jobs.",
"main": "src/index.js",
"engines": {
"node": ">= 10.15.0"
},
"files": [
"/src",
"/CONTRIBUTING.md"
],
"scripts": {
"eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check",
"lint": "eslint .",
Expand Down Expand Up @@ -41,7 +45,7 @@
"eslint-plugin-standard": "^4.0.0",
"faker": "^4.1.0",
"husky": "^1.3.1",
"lint-staged": "^8.1.0",
"lint-staged": "^8.1.1",
"mocha": "^6.0.0-1",
"nyc": "^13.1.0",
"prettier": "^1.16.1",
Expand Down
3 changes: 1 addition & 2 deletions src/defaults.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const defaults = {
url: process.env.AMQP_URL || 'amqp://localhost',
exchange: ''
url: process.env.AMQP_URL || 'amqp://localhost'
}

module.export = defaults
3 changes: 2 additions & 1 deletion src/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const ERRORS = {
QUEUE_ALREADY_STARTED: 'Message Queue has already been started',
QUEUE_NOT_STARTED: 'Message Queue has not been started',
TASK_MISSING:
'You must provide an async pure function as a task for the worker to perform'
'You must provide an async pure function as a task for the worker to perform',
WRONG_CORRELATION_ID: 'The provided correlationId is incorrect'
}

module.exports = ERRORS
Loading

0 comments on commit 2c2a0b8

Please sign in to comment.