rabbit_jobs 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -159,19 +159,6 @@ module RabbitJobs
159
159
  @data[:queues].keys
160
160
  end
161
161
 
162
- def init_default_queue
163
- queue('default', DEFAULT_QUEUE_PARAMS) if @data[:queues].empty?
164
- end
165
-
166
- def worker_queues
167
- @data[:workers].values.map{|w| w[:queues].to_s.split(' ')}.flatten.uniq.sort
168
- end
169
-
170
- def default_queue
171
- queue('default', DEFAULT_QUEUE_PARAMS) if @data[:queues].empty?
172
- worker_queues.first
173
- end
174
-
175
162
  def queue_name(routing_key)
176
163
  routing_key = routing_key.to_sym
177
164
  @data[:queues][routing_key][:ignore_prefix] ? routing_key : [@data[:prefix], routing_key].compact.join('#')
@@ -27,10 +27,6 @@ module RabbitJobs
27
27
  self._connection = self._channel = nil
28
28
  end
29
29
 
30
- def publish(klass, *params, &block)
31
- publish_to(RJ.config.default_queue, klass, *params, &block)
32
- end
33
-
34
30
  def publish_to(routing_key, klass, *params, &block)
35
31
  raise ArgumentError.new("klass=#{klass.inspect}") unless klass && (klass.is_a?(Class) || klass.is_a?(String))
36
32
  raise ArgumentError.new("routing_key=#{routing_key}") unless routing_key && (routing_key.is_a?(Symbol) || routing_key.is_a?(String)) && !!RJ.config[:queues][routing_key.to_sym]
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module RabbitJobs
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
  end
@@ -59,15 +59,15 @@ module RabbitJobs
59
59
  # in alphabetical order. Queues can be dynamically added or
60
60
  # removed without needing to restart workers using this method.
61
61
  def initialize(*queues)
62
- RJ.config.init_default_queue
63
62
  @queues = queues.map { |queue| queue.to_s.strip }.flatten.uniq
64
63
  if @queues == ['*'] || @queues.empty?
65
64
  @queues = RabbitJobs.config.routing_keys
66
65
  end
66
+ raise "Cannot initialize worker without queues." if @queues.empty?
67
67
  end
68
68
 
69
69
  def queues
70
- @queues || [:default]
70
+ @queues || []
71
71
  end
72
72
 
73
73
  # Subscribes to queue and working on jobs
data/lib/rabbit_jobs.rb CHANGED
@@ -52,20 +52,6 @@ module RabbitJobs
52
52
  EM.reactor_running?
53
53
  end
54
54
 
55
- def publish(klass, *params, &block)
56
- if RJ.running?
57
- RJ::Publisher.publish(klass, *params, &block)
58
- else
59
- RJ.run {
60
- RJ::Publisher.publish(klass, *params) {
61
- RJ.stop {
62
- yield if block_given?
63
- }
64
- }
65
- }
66
- end
67
- end
68
-
69
55
  def publish_to(routing_key, klass, *params, &block)
70
56
  if RJ.running?
71
57
  RJ::Publisher.publish_to(routing_key, klass, *params, &block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: amqp
16
- requirement: &10683080 !ruby/object:Gem::Requirement
16
+ requirement: &8850920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.9'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *10683080
24
+ version_requirements: *8850920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &10699400 !ruby/object:Gem::Requirement
27
+ requirement: &8863540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *10699400
35
+ version_requirements: *8863540
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rufus-scheduler
38
- requirement: &10695720 !ruby/object:Gem::Requirement
38
+ requirement: &8882600 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *10695720
46
+ version_requirements: *8882600
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rails
49
- requirement: &10715860 !ruby/object:Gem::Requirement
49
+ requirement: &8879640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *10715860
57
+ version_requirements: *8879640
58
58
  description: Background jobs on RabbitMQ
59
59
  email:
60
60
  - lazureykis@gmail.com
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  segments:
113
113
  - 0
114
- hash: -332224459976607179
114
+ hash: 172284272665081272
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  segments:
122
122
  - 0
123
- hash: -332224459976607179
123
+ hash: 172284272665081272
124
124
  requirements: []
125
125
  rubyforge_project:
126
126
  rubygems_version: 1.8.11