celerb 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/celerb/task_publisher.rb +4 -4
- data/lib/celerb.rb +1 -1
- metadata +4 -4
@@ -2,9 +2,9 @@ module Celerb
|
|
2
2
|
class TaskPublisher
|
3
3
|
|
4
4
|
def self.connect(opts)
|
5
|
-
|
5
|
+
@exchange = MQ.direct(opts[:exchange],
|
6
6
|
:key => opts[:key], :durable => true)
|
7
|
-
|
7
|
+
@results = ResultConsumer.new
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.delay_task(task_name, task_args=[], task_kwargs={},
|
@@ -24,13 +24,13 @@ module Celerb
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.register_result_handler(task_id, expiry, &blk)
|
27
|
-
|
27
|
+
@results.register(task_id, expiry, &blk)
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
32
|
def self.publish(body)
|
33
|
-
|
33
|
+
@exchange.publish MessagePack.pack(body), {
|
34
34
|
:content_type => 'application/x-msgpack',
|
35
35
|
:content_encoding => 'binary'
|
36
36
|
}
|
data/lib/celerb.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celerb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dusan Maliarik
|