celerb 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ require 'msgpack'
7
7
  require 'uuid'
8
8
 
9
9
  module Celerb
10
- VERSION = '0.3.2'
10
+ VERSION = '0.3.3'
11
11
  end
12
12
 
13
13
  require 'celerb/task'
@@ -1,8 +1,9 @@
1
1
  module Celerb
2
2
  class ResultConsumer
3
3
 
4
- def initialize channel
4
+ def initialize channel, opts={}
5
5
  @channel = channel
6
+ @options = opts
6
7
  @handlers = {}
7
8
  EM.add_periodic_timer(60) do
8
9
  now = Time.now
@@ -34,7 +35,12 @@ module Celerb
34
35
  end
35
36
 
36
37
  def task_id_to_queue(task_id)
37
- @channel.queue(task_id.delete('-'), :auto_delete => true)
38
+ puts @channel.inspect
39
+ @channel.queue(task_id.delete('-'), :auto_delete => true,
40
+ :arguments => (
41
+ @options[:results_arguments] and
42
+ Hash[@options[:results_arguments].map{|k, v| [k.to_s, v]}] or
43
+ {}))
38
44
  end
39
45
 
40
46
  end
@@ -5,7 +5,7 @@ module Celerb
5
5
  channel = AMQP::Channel.new
6
6
  @exchange = channel.direct(opts[:exchange],
7
7
  :key => opts[:key], :durable => true)
8
- @results = ResultConsumer.new(channel)
8
+ @results = ResultConsumer.new channel, opts
9
9
  end
10
10
 
11
11
  def self.delay_task(task_name, task_args=[], task_kwargs={},
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dusan Maliarik
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-18 00:00:00 +02:00
18
+ date: 2011-05-02 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency