rabbit_jobs 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1dbb64dd4436781ef5da26ddb87961c600611ae
4
- data.tar.gz: 6d6087f8f50cab47cae8a0d41d59f13cba3dce95
3
+ metadata.gz: dff8d6171cd4174eef097c45b1882db5c00721fc
4
+ data.tar.gz: 38e0f6d1d73e3be81445ff5dec95c79155a07e43
5
5
  SHA512:
6
- metadata.gz: 4a42fdd19723688827b566a0939df848723656e054d30e061c72378d3b717798ec38c7b707b07239bedac0d5b4b5b04297239aa23de78323cc49d75501b73e82
7
- data.tar.gz: c6bdbabad8bb858395bf9b280a5cf6f2c2de245f8333b60a9214ce884e619d506cd7d25c2ad383959b9e0e55546f6deec07e8a7db42c6cacfe75d83e4212307f
6
+ metadata.gz: 5054d1af4332fc96218d42b2c8fadc3b06286c688c76e9ce2af88f42c0d2a43a901c235105afaa7ca895a8fe22064b4ef261823ae51ee452ec64d47d4226de97
7
+ data.tar.gz: 7caadfdde460a34dd0004adf5cbce2658c7c94a49b1c397fc04212304b24c3a9a6985603a80ad46d71cd866074aff436fdcc3ce6acb324b65086b74e268225f2
@@ -1,19 +1,12 @@
1
1
  require 'rabbit_jobs/publisher/amqp'
2
2
  require 'rabbit_jobs/publisher/test'
3
+ require 'rabbit_jobs/publisher/sync'
3
4
 
4
5
  module RabbitJobs
5
6
  class Publisher
6
7
  class << self
7
-
8
- @publisher_type = Amqp
9
-
10
8
  def mode
11
- case @publisher_type
12
- when Amqp
13
- :amqp
14
- when Test
15
- :test
16
- end
9
+ publisher_type.class_name.underscore
17
10
  end
18
11
 
19
12
  def mode=(value)
@@ -22,6 +15,8 @@ module RabbitJobs
22
15
  Amqp
23
16
  when 'test'
24
17
  Test
18
+ when 'sync'
19
+ Sync
25
20
  else
26
21
  raise ArgumentError.new("value must be :amqp or :test. Passed: #{value.inspect}")
27
22
  end
@@ -34,10 +29,8 @@ module RabbitJobs
34
29
  private
35
30
 
36
31
  def publisher_type
37
- @publisher_type
32
+ @publisher_type || Amqp
38
33
  end
39
34
  end
40
35
  end
41
- end
42
-
43
- RabbitJobs::Publisher.mode ||= :amqp
36
+ end
@@ -0,0 +1,24 @@
1
+ require 'rabbit_jobs/publisher/base'
2
+
3
+ module RabbitJobs
4
+ class Publisher
5
+ class Sync < Base
6
+ class << self
7
+
8
+ def cleanup
9
+ end
10
+
11
+ def publish_to(routing_key, klass, *params)
12
+ raise ArgumentError.new("klass=#{klass.inspect}") unless klass.is_a?(Class) || klass.is_a?(String)
13
+ routing_key = routing_key.to_sym unless routing_key.is_a?(Symbol)
14
+ raise ArgumentError.new("routing_key=#{routing_key}") unless RabbitJobs.config[:queues][routing_key]
15
+
16
+ klass.perform(*params)
17
+ end
18
+
19
+ def purge_queue(*routing_keys)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module RabbitJobs
4
- VERSION = "0.11.3"
4
+ VERSION = "0.11.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Lazureykis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-14 00:00:00.000000000 Z
11
+ date: 2014-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -164,6 +164,7 @@ files:
164
164
  - lib/rabbit_jobs/publisher.rb
165
165
  - lib/rabbit_jobs/publisher/amqp.rb
166
166
  - lib/rabbit_jobs/publisher/base.rb
167
+ - lib/rabbit_jobs/publisher/sync.rb
167
168
  - lib/rabbit_jobs/publisher/test.rb
168
169
  - lib/rabbit_jobs/scheduler.rb
169
170
  - lib/rabbit_jobs/tasks.rb