tennis-jobs 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +5 -5
- data/examples/serializer.rb +1 -1
- data/lib/tennis/worker/deferable/action.rb +1 -1
- data/lib/tennis/worker/generic.rb +1 -1
- data/tennis-jobs.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbb90feec2f2e77454b97d27427725c8a742f43d
|
4
|
+
data.tar.gz: 116901e81bdb636395102e79e154b3237055b216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27600764daf9001be443cfea63c92933bb6dd4a0a234192fd12ed9087f8f1967df6f0f8d582ed9aedcc5e53ce7ae08a495edaefc787fc55ffb1a4df7bcdd9281
|
7
|
+
data.tar.gz: b3e4e2cf9fc030865c71b72817e4af930bfffd0ebfe92bcc21b7e4489fe629a9018e9320aac1f56f6827b6f8ebbf92d39e2b4556a53d340915329ec37eb79fe7
|
data/README.markdown
CHANGED
@@ -45,7 +45,7 @@ command:
|
|
45
45
|
The `workers` options is directly given to sneakers, it will determine the
|
46
46
|
number of subprocesses that will handle the messages, the level of parallelism.
|
47
47
|
|
48
|
-
The classes are the classes that will receive your `
|
48
|
+
The classes are the classes that will receive your `send_work` or `defer` calls
|
49
49
|
but we'll see that later...
|
50
50
|
|
51
51
|
Also it is possible to add options directly in your workers:
|
@@ -97,7 +97,7 @@ class MyClass
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
MyClass.
|
100
|
+
MyClass.send_work("my class")
|
101
101
|
# => Before processing
|
102
102
|
# => Working with my class
|
103
103
|
```
|
@@ -105,7 +105,7 @@ MyClass.execute("my class")
|
|
105
105
|
### Serializers
|
106
106
|
|
107
107
|
You can provide a Proc for the loader and/or the dumper keywords.
|
108
|
-
The dumper will be used when calling `MyClass.
|
108
|
+
The dumper will be used when calling `MyClass.send_work(message)` receiving
|
109
109
|
the `message` as argument. It should return a string. The loader will be
|
110
110
|
used when the message is poped from the RabbitMQ queue.
|
111
111
|
|
@@ -124,7 +124,7 @@ class MyClass
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
-
MyClass.
|
127
|
+
MyClass.send_work([1, "foo"])
|
128
128
|
# => Message is serialized and deserialized correctly
|
129
129
|
# => one: 1, two: foo
|
130
130
|
```
|
@@ -143,7 +143,7 @@ class MyClass
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
-
MyClass.
|
146
|
+
MyClass.send_work([String, User.find(1)])
|
147
147
|
# => Classes can be passed: String - Class
|
148
148
|
# => Active record object can be passed too: <User#1 ...>
|
149
149
|
```
|
data/examples/serializer.rb
CHANGED
@@ -32,6 +32,6 @@ Example.new(__FILE__, SumWorker).run do
|
|
32
32
|
array = Array.new(5) { 1 + rand(5) }
|
33
33
|
print "Press enter to enqueue a random array..." ; gets
|
34
34
|
puts "Sending #{array.inspect} to the #{SumWorker::Worker.queue_name} queue!"
|
35
|
-
SumWorker.
|
35
|
+
SumWorker.send_work(array)
|
36
36
|
end
|
37
37
|
|
@@ -10,7 +10,7 @@ class Tennis::Worker::Deferable::Action
|
|
10
10
|
def _create_methods!
|
11
11
|
_methods.each do |method|
|
12
12
|
self.define_singleton_method(method) do |*arguments|
|
13
|
-
@worker_class.
|
13
|
+
@worker_class.send_work([@receiver, method, arguments])
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/tennis-jobs.gemspec
CHANGED