rabbithole 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/README.md +24 -3
- data/lib/rabbithole/error_handler.rb +2 -2
- data/lib/rabbithole/error_handlers/null_handler.rb +1 -1
- data/lib/rabbithole/error_handlers/raise_handler.rb +1 -1
- data/lib/rabbithole/version.rb +1 -1
- data/lib/rabbithole/worker.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 706942dfa06a6e05466a3d939c55532a2deed660
|
4
|
+
data.tar.gz: 1e5c8868486b62397c5bcbe5f3ee55d3da9dd90e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3fea997bc2c26ccbd2d0ee52cc9acfa515a59985574e7eb6fe98ace6226a3c5592621ba54605fb593e5816f5bde5d48d4c5b3fcecf512e40139390024542be5
|
7
|
+
data.tar.gz: 524408dd6c35f7201e5803128f764bc7e22fc77d98ad8184be915214012ab78eeea895a29b9a95222893ca5a80022319d3a6fc46ee933904c6946a08308cf39e
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -29,7 +29,8 @@ Or install it yourself as:
|
|
29
29
|
|
30
30
|
## Usage
|
31
31
|
|
32
|
-
|
32
|
+
### Defining jobs
|
33
|
+
When defining a job, make sure it has a `perform` method:
|
33
34
|
```ruby
|
34
35
|
class MyAwesomeJob
|
35
36
|
def self.perform
|
@@ -38,12 +39,32 @@ class MyAwesomeJob
|
|
38
39
|
end
|
39
40
|
```
|
40
41
|
|
41
|
-
|
42
|
+
### Enqueueing jobs:
|
42
43
|
```ruby
|
43
44
|
Rabbithole.enqueue MyAwesomeJob
|
44
45
|
```
|
45
46
|
|
46
|
-
|
47
|
+
You can pass arguments to the perform method like so:
|
48
|
+
```ruby
|
49
|
+
Rabbithole.enqueue MyAwesomeJob, arg1, arg2
|
50
|
+
```
|
51
|
+
|
52
|
+
Gotchas:
|
53
|
+
|
54
|
+
* The number of arguments you pass in has to match the arity of your perform function.
|
55
|
+
* Also Hash keys will end up as strings in the perform function, even if they were passed as symbols.
|
56
|
+
* Only serializable arguments are supported. Passing in arbitrary objects will not work.
|
57
|
+
|
58
|
+
### Running jobs
|
59
|
+
You will have to invoke the binary and specify the queues you want to execute. **As opposed to resque, the queue * denotes the default queue, not all queues!**
|
60
|
+
|
61
|
+
Example:
|
62
|
+
|
63
|
+
bundle exec rabbithole work --queues "*" cache
|
64
|
+
|
65
|
+
For further options type `rabbithole help work`.
|
66
|
+
|
67
|
+
|
47
68
|
|
48
69
|
## Contributing
|
49
70
|
|
@@ -3,8 +3,8 @@ module Rabbithole
|
|
3
3
|
class << self
|
4
4
|
@@registered_handler = Rabbithole::ErrorHandlers::RaiseHandler
|
5
5
|
|
6
|
-
def handle(error)
|
7
|
-
@@registered_handler.handle(error)
|
6
|
+
def handle(error, queue, payload)
|
7
|
+
@@registered_handler.handle(error, queue, payload)
|
8
8
|
end
|
9
9
|
|
10
10
|
def register_handler(handler)
|
data/lib/rabbithole/version.rb
CHANGED
data/lib/rabbithole/worker.rb
CHANGED
@@ -29,7 +29,7 @@ module Rabbithole
|
|
29
29
|
@channel.acknowledge(delivery_info.delivery_tag, false)
|
30
30
|
rescue => e
|
31
31
|
@channel.reject(delivery_info.delivery_tag, !delivery_info.redelivered)
|
32
|
-
ErrorHandler.handle(e)
|
32
|
+
ErrorHandler.handle(e, queue.name, payload)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabbithole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Schaefermeyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|