Skip to content

Commit 7cf6c81

Browse files
committed
Merge branch 'release/1.0.8'
2 parents 7bb1876 + 7e6e32c commit 7cf6c81

File tree

4 files changed

+982
-604
lines changed

4 files changed

+982
-604
lines changed

CONTRIBUTING.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ git config user.email "[email protected]"
4646

4747
#### Hotfixes and Support branches
4848

49-
It's basically the same process but use the word `hotfix` or `support` instead of `feature`. `git flow` knows what to do. Just keep in mind that any changes are going to happen to your fork, and not the upstream repo. If you need to merge a `hotfix` into upstream master you may only do it va a reviewed pull request.
49+
It's basically the same process but use the word `hotfix` or `support` instead of `feature`. `git flow` knows what to do. Just keep in mind that any changes are going to happen to your fork, and not the upstream repo. If you need to merge a `hotfix` into upstream master you may only do it va a reviewed pull request.
5050

5151
### Releasing to production
5252

@@ -56,7 +56,7 @@ It's basically the same process but use the word `hotfix` or `support` instead o
5656
4. Now go back to GitHub and raise a Pull Request to merge the upstream master from your fork's `master` branch. When that goes through you are done.
5757
5. In your command-line go back and clean up any outstanding branches and `git pull upstream` your local `master` and `develop` branches to ensure everything on your local machine is up to date with everyone's changes.
5858

59-
Note you will **never** push changes directly to the upstream project, *only to your own fork*.
59+
Note you will **never** push changes directly to the upstream project, _only to your own fork_.
6060

6161
**Changes may only be introduced into the upstream project via a properly reviewed pull request.**
6262

@@ -72,27 +72,27 @@ Note this will creating a feature via `git flow` will create a branch called `fe
7272

7373
### Commit Messages
7474

75-
When commiting something use the `-m` flag to add a short commit message of the format `{issue number} summary of what you changed`. So for example if you are working on issue `ABC-1` and you added a method to the `aardvark_controller` you might use the following commit message `"ABC-1 added anteater method to aardvark controller"`
75+
When commiting something use the `-m` flag to add a short commit message of the format `{issue number} summary of what you changed`. So for example if you are working on issue `ABC-1` and you added a method to the `aardvark_controller` you might use the following commit message `"ABC-1 added anteater method to aardvark controller"`
7676

7777
Commit messages ought to be in the past tense.
7878

7979
In general try to group file changes wherever appropriate, so if your controller change also involved updating something in a helper file, the one commit message can happily encompas the changes to both files. The message ought to reflect the main aim of the change.
8080

8181
### Pull Requests
8282

83-
Pull requests must be named as follows `[issue type, issue number] high level description of change`. The following Issue Types are recognised
83+
Pull requests must be named as follows `[issue type, issue number] high level description of change`. The following Issue Types are recognised
8484

85-
* `Bug Fix` - the change fixes a bug
86-
* `Feature` - the change adds a new feature (the usual issue type)
87-
* `Documentation` — The change is a documentation only change
88-
* `Optimisation` - The change is an optimisation of the code base without any functional changes
85+
- `Bug Fix` - the change fixes a bug
86+
- `Feature` - the change adds a new feature (the usual issue type)
87+
- `Documentation` — The change is a documentation only change
88+
- `Optimisation` - The change is an optimisation of the code base without any functional changes
8989

9090
If your change does not fit any of these categories, use `Feature`. Likewise if your change is not tied to an issue number you may use `n/a` instead.
9191

9292
So to use the above example your Pull Request would be named `[Feature, ABC-1] added anteater to aardvark`
9393

9494
### You built it, you merge it
9595

96-
A developer must be responsible for their own work, from accepting a task through to merging to production. With that in mind if you review another developer's PR, please don't then merge it yourself. As a general rule you must let the developer merge her own PRs.
96+
A developer must be responsible for their own work, from accepting a task through to merging to production. With that in mind if you review another developer's PR, please don't then merge it yourself. As a general rule you must let the developer merge her own PRs.
9797

98-
Likewise, don't expect someone else to merge your PR. Unless you do not have write permission on a project, you will always aim to take personal responsibility for the quality of the code that gets merged in.
98+
Likewise, don't expect someone else to merge your PR. Unless you do not have write permission on a project, you will always aim to take personal responsibility for the quality of the code that gets merged in.

README.md

+77-53
Original file line numberDiff line numberDiff line change
@@ -4,118 +4,142 @@
44

55
A simple Pub Sub system that uses AMQP Messaging to exchange data between services
66

7-
* `develop`[![CircleCI](https://circleci.com/gh/davesag/amqp-simple-pub-sub/tree/develop.svg?style=svg)](https://circleci.com/gh/davesag/amqp-simple-pub-sub/tree/develop) [![codecov](https://codecov.io/gh/davesag/amqp-simple-pub-sub/branch/develop/graph/badge.svg)](https://codecov.io/gh/davesag/amqp-simple-pub-sub)
8-
* `master`[![CircleCI](https://circleci.com/gh/davesag/amqp-simple-pub-sub/tree/master.svg?style=svg)](https://circleci.com/gh/davesag/amqp-simple-pub-sub/tree/master) [![codecov](https://codecov.io/gh/davesag/amqp-simple-pub-sub/branch/master/graph/badge.svg)](https://codecov.io/gh/davesag/amqp-simple-pub-sub)
7+
<!-- prettier-ignore -->
8+
| Branch | Tests | Code Coverage | Comments |
9+
| ------ | ----- | ------------- | -------- |
10+
| `develop` | [![CircleCI](https://circleci.com/gh/davesag/amqp-simple-pub-sub/tree/develop.svg?style=svg)](https://circleci.com/gh/davesag/amqp-simple-pub-sub/tree/develop) | [![codecov](https://codecov.io/gh/davesag/amqp-simple-pub-sub/branch/develop/graph/badge.svg)](https://codecov.io/gh/davesag/amqp-simple-pub-sub) | Work in progress |
11+
| `master` | [![CircleCI](https://circleci.com/gh/davesag/amqp-simple-pub-sub/tree/master.svg?style=svg)](https://circleci.com/gh/davesag/amqp-simple-pub-sub/tree/master) | [![codecov](https://codecov.io/gh/davesag/amqp-simple-pub-sub/branch/master/graph/badge.svg)](https://codecov.io/gh/davesag/amqp-simple-pub-sub) | Latest release |
912

1013
[![NPM](https://nodei.co/npm/amqp-simple-pub-sub.png)](https://nodei.co/npm/amqp-simple-pub-sub/)
1114

1215
## To Use
1316

1417
You project needs to be using at least Node version 8, and ideally Node 10 (LTS) or later.
1518

16-
npm install amqp-simple-pub-sub
19+
```
20+
npm install amqp-simple-pub-sub
21+
```
1722

1823
### Create a Publisher
19-
const { makePublisher } = require('amqp-simple-pub-sub')
20-
const publisher = makePublisher({ exchange: 'testService' })
24+
25+
```
26+
const { makePublisher } = require('amqp-simple-pub-sub')
27+
const publisher = makePublisher({ exchange: 'testService' })
28+
```
2129

2230
### Publish a message
2331

24-
await publisher.start()
25-
publisher.publish('test', 'Hello World')
32+
```
33+
await publisher.start()
34+
publisher.publish('test', 'Hello World')
35+
```
2636

2737
### Create a Subscriber
2838

29-
const { makeSubscriber } = require('amqp-simple-pub-sub')
39+
```
40+
const { makeSubscriber } = require('amqp-simple-pub-sub')
3041
31-
const subscriber = makeSubscriber({
32-
exchange: 'testService',
33-
queueName: 'testQueue',
34-
routingKeys: ['test']
35-
})
42+
const subscriber = makeSubscriber({
43+
exchange: 'testService',
44+
queueName: 'testQueue',
45+
routingKeys: ['test']
46+
})
47+
```
3648

3749
### Subscribe to a queue and listen for messages
3850

39-
const handler = message => {
40-
console.log('Message Received', message)
41-
subscriber.ack(message)
42-
}
51+
```
52+
const handler = message => {
53+
console.log('Message Received', message)
54+
subscriber.ack(message)
55+
}
4356
44-
subscriber.start(handler)
57+
subscriber.start(handler)
58+
```
4559

4660
### Other Options
4761

4862
#### Publisher
4963

5064
The full options object is as follows
5165

52-
{
53-
type: 'topic' // the default
54-
url: 'amqp://localhost' // the default
55-
exchange: 'you must provide this' // it's the name of your service usually
56-
onError: err => { // optional
57-
console.error('A connection error happened', err) // or do something clever
58-
}
59-
onClose: () => { // optional
60-
console.log('The connection has closed.') // or do something clever
61-
}
62-
}
66+
```
67+
{
68+
type: 'topic', // the default
69+
url: 'amqp://localhost', // the default
70+
exchange: 'you must provide this', // it's the name of your service usually
71+
onError: err => { // optional
72+
console.error('A connection error happened', err) // or do something clever
73+
},
74+
onClose: () => { // optional
75+
console.log('The connection has closed.') // or do something clever
76+
}
77+
}
78+
```
6379

6480
#### Subscriber
6581

6682
The full options object is as follows
6783

68-
{
69-
type: 'topic' // the default
70-
url: 'amqp://localhost' // the default
71-
exchange: 'you must provide this' // it's the name of your service usually
72-
queueName: 'you must also provide this' // give your queue a name
73-
routingKeys: ['an', 'array', 'of', 'routingKeys'] // optional. Uses [queueName] otherwise.
74-
onError: err => { // optional
75-
console.error('A connection error happened', err) // or do something clever
76-
}
77-
onClose: () => { // optional
78-
console.log('The connection has closed.') // or do something clever
79-
}
80-
}
84+
```
85+
{
86+
type: 'topic', // the default
87+
url: 'amqp://localhost', // the default
88+
exchange: 'you must provide this', // it's the name of your service usually
89+
queueName: 'you must also provide this', // give your queue a name
90+
routingKeys: ['an', 'array', 'of', 'routingKeys'], // optional. Uses [queueName] otherwise.
91+
onError: err => { // optional
92+
console.error('A connection error happened', err) // or do something clever
93+
},
94+
onClose: () => { // optional
95+
console.log('The connection has closed.') // or do something clever
96+
}
97+
}
98+
```
8199

82100
#### Examples
83101

84102
See some examples in the tests, and also:
85103

86-
* [competing-services-example](https://github.com/davesag/competing-services-example)
87-
* And the associated article: [itnext.io/connecting-competing-microservices-using-rabbitmq](https://itnext.io/connecting-competing-microservices-using-rabbitmq-28e5269861b6)
104+
- [competing-services-example](https://github.com/davesag/competing-services-example)
105+
- And the associated article: [itnext.io/connecting-competing-microservices-using-rabbitmq](https://itnext.io/connecting-competing-microservices-using-rabbitmq-28e5269861b6)
88106

89107
## Related Projects
90108

91-
* [`amqp-delegate`](https://github.com/davesag/amqp-delegate) — A library that simplifies, to the point of triviality, use of AMQP based remote workers.
92-
* [`ampq-event-tester`](https://github.com/davesag/amqp-event-tester) — A Dockerised and configurable utility to help integration-test your amqp services.
109+
- [`amqp-delegate`](https://github.com/davesag/amqp-delegate) — A library that simplifies, to the point of triviality, use of AMQP based remote workers.
110+
- [`ampq-event-tester`](https://github.com/davesag/amqp-event-tester) — A Dockerised and configurable utility to help integration-test your amqp services.
93111

94112
## Development
95113

96114
### Prerequisites
97115

98-
* [NodeJS](htps://nodejs.org), version 10.15.1 (LTS) or better (I use [`nvm`](https://github.com/creationix/nvm) to manage Node versions — `brew install nvm`.)
99-
* [Docker](https://www.docker.com) (Use [Docker for Mac](https://docs.docker.com/docker-for-mac/), not the homebrew version)
116+
- [NodeJS](htps://nodejs.org), version 10.15.3 (LTS) or better (I use [`nvm`](https://github.com/creationix/nvm) to manage Node versions — `brew install nvm`.)
117+
- [Docker](https://www.docker.com) (Use [Docker for Mac](https://docs.docker.com/docker-for-mac/), not the homebrew version)
100118

101119
### Initialisation
102120

103-
npm install
121+
```
122+
npm install
123+
```
104124

105125
### To Start the queue server for integration testing.
106126

107-
docker-compose up -d
127+
```
128+
docker-compose up -d
129+
```
108130

109131
Runs Rabbit MQ.
110132

111133
### Test it
112134

113-
* `npm test` — runs the unit tests (quick and does not need rabbit mq running)
114-
* `npm run test:integration` — runs the integration tests (not so quick and needs rabbitmq running)
135+
- `npm test` — runs the unit tests (quick and does not need rabbit mq running)
136+
- `npm run test:integration` — runs the integration tests (not so quick and needs rabbitmq running)
115137

116138
### Lint it
117139

118-
npm run lint
140+
```
141+
npm run lint
142+
```
119143

120144
## Contributing
121145

0 commit comments

Comments
 (0)