pwwka 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +15 -0
- data/Gemfile.lock +1 -1
- data/README.md +35 -8
- data/lib/pwwka/test_handler.rb +4 -2
- data/lib/pwwka/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65628463d1a49c21c4d625717b05aee5867b0b0b
|
4
|
+
data.tar.gz: 8bc5ab193a6ddee8b94118d443c4b88d38e7a11f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14a4657dd79e421d4a9b61f382da7d827042b98a4a0d91f63eb54e24a66ee5803bde96114ec52f7b48e8a0c77fc8777f07e67de2ae72c8f813e19b635cf0cb7b
|
7
|
+
data.tar.gz: ba321ef6cbf41a02e4052cb978b86c9293e24e5868f577b41c16875c0781b7dc9e8cf11f3272f8bee73a6f4aeaa4a8bd2413ea787ab59f1c36060cf8061942a9
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
## Contributing
|
3
|
+
|
4
|
+
We're actively using Pwwka in production here at [Stitch Fix](http://technology.stitchfix.com/) and look forward to seeing Pwwka grow and improve with your help. Contributions are warmly welcomed.
|
5
|
+
|
6
|
+
To contribute,
|
7
|
+
1. make a fork of the project
|
8
|
+
2. write some code (with tests please!)
|
9
|
+
3. open a Pull Request
|
10
|
+
4. bask in the warm fuzzy Open Source hug from us
|
11
|
+
|
12
|
+
## Testing
|
13
|
+
<a name="testing"></a>
|
14
|
+
|
15
|
+
You must be running RabbitMQ locally on the default port in order for the tests to work.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# Pwwka
|
2
|
+
|
3
|
+
|
4
|
+
Pronounced "Poo-ka" |ˈpo͞okə|
|
5
|
+
|
6
|
+
![Pwwka Bunny Bus](http://res.cloudinary.com/stitch-fix/image/upload/c_scale,w_317/v1408570794/bunny-bus_ba72ou.png)
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
|
1
11
|
This gem connects to a topic exchange on a RabbitMQ server. It gives any app using it the ability to do two things:
|
2
12
|
|
3
13
|
* Transmit messages to the exchange
|
@@ -154,9 +164,10 @@ The available wildcards are as follows
|
|
154
164
|
|
155
165
|
__A note on re-queuing:__ At the moment messages that raise an error on receipt are marked 'not acknowledged, don't resend', and the failure message is logged. All unacknowledged messages will be resent when the worker is restarted. The next iteration of this gem will allow for a specified number of resends without requiring a restart.
|
156
166
|
|
157
|
-
__Spinning up some
|
167
|
+
__Spinning up some more handlers to handle the load:__ Since each named queue will receive each message only once you can spin up multiple process using the *same named queue* and they will share the messages between them. If you spin up three processes each will receive roughly one third of the messages, but each message will still only be received once.
|
158
168
|
|
159
169
|
### Handlers
|
170
|
+
|
160
171
|
Handlers are simple classes that must respond to `self.handle!`. The receiver will send the handler three arguments:
|
161
172
|
|
162
173
|
* `delivery_info` - [a bunch of stuff](http://rubybunny.info/articles/queues.html#accessing_message_delivery_information)
|
@@ -168,7 +179,6 @@ Here is an example:
|
|
168
179
|
```ruby
|
169
180
|
class ClientIndexMessageHandler
|
170
181
|
|
171
|
-
attr_reader :payload
|
172
182
|
def initialize(payload)
|
173
183
|
@payload = payload
|
174
184
|
end
|
@@ -189,19 +199,25 @@ end
|
|
189
199
|
```
|
190
200
|
|
191
201
|
## Monitoring
|
202
|
+
|
192
203
|
RabbitMQ has a good API that should make it easy to set up some simple monitoring. In the meantime there is logging and manual monitoring.
|
193
204
|
|
194
205
|
### Logging
|
206
|
+
|
195
207
|
The receiver logs details of any exception raised in message handling:
|
208
|
+
|
196
209
|
```ruby
|
197
210
|
error "Error Processing Message on #{queue_name} -> #{payload}, #{delivery_info.routing_key}: #{e}"
|
198
211
|
```
|
199
|
-
|
212
|
+
|
213
|
+
The transmitter will likewise log an error if you use the `_safely` methods:
|
214
|
+
|
200
215
|
```ruby
|
201
216
|
error "Error Transmitting Message on #{routing_key} -> #{payload}: #{e}"
|
202
217
|
```
|
203
218
|
|
204
219
|
### Manual monitoring
|
220
|
+
|
205
221
|
RabbitMQ has a web interface for checking out the health of connections, channels, exchanges and queues. Access it via the Heroku add-ons page for Enigma.
|
206
222
|
|
207
223
|
![RabbitMQ Management 1](docs/images/RabbitMQ_Management.png)
|
@@ -251,8 +267,19 @@ describe "my integration test" do
|
|
251
267
|
end
|
252
268
|
```
|
253
269
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
270
|
+
The pwwka gem has tests for all its functionality, so testing your app is best done with mocks on this gem.
|
271
|
+
|
272
|
+
However, if you want to test the message bus end-to-end in your app you can use some helpers in `lib/pwwka/test_handler.rb`. See this gem's specs for examples of how to use them.
|
273
|
+
|
274
|
+
[See CONTRIBUTING.md for details on testing this gem](CONTRIBUTING.md#testing)
|
275
|
+
|
276
|
+
## Contributing
|
277
|
+
|
278
|
+
We're actively using Pwwka in production here at [Stitch Fix](http://technology.stitchfix.com/) and look forward to seeing Pwwka grow and improve with your help. Contributions are warmly welcomed.
|
279
|
+
|
280
|
+
[See CONTRIBUTING.md for details](CONTRIBUTING.md)
|
281
|
+
|
282
|
+
## Licence
|
283
|
+
|
284
|
+
Pwwka is released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
285
|
+
|
data/lib/pwwka/test_handler.rb
CHANGED
@@ -65,8 +65,10 @@ module Pwwka
|
|
65
65
|
test_queue.delete
|
66
66
|
channel_connector.topic_exchange.delete
|
67
67
|
# delayed messages
|
68
|
-
|
69
|
-
|
68
|
+
unless Pwwka.configuration.allow_delayed?
|
69
|
+
channel_connector.delayed_queue.delete
|
70
|
+
channel_connector.delayed_exchange.delete
|
71
|
+
end
|
70
72
|
|
71
73
|
channel_connector.connection_close
|
72
74
|
end
|
data/lib/pwwka/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwwka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stitch Fix Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- ".gitignore"
|
108
108
|
- ".ruby-gemset"
|
109
109
|
- ".ruby-version"
|
110
|
+
- CONTRIBUTING.md
|
110
111
|
- Gemfile
|
111
112
|
- Gemfile.lock
|
112
113
|
- README.md
|
@@ -151,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
152
|
version: '0'
|
152
153
|
requirements: []
|
153
154
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.2.0
|
155
|
+
rubygems_version: 2.2.0.rc.1
|
155
156
|
signing_key:
|
156
157
|
specification_version: 4
|
157
158
|
summary: Send and receive messages via RabbitMQ
|