waffle 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/waffle.rb +10 -0
- data/lib/waffle/transports/rabbitmq.rb +2 -2
- data/lib/waffle/version.rb +1 -1
- metadata +3 -3
data/lib/waffle.rb
CHANGED
@@ -52,6 +52,16 @@ module Waffle
|
|
52
52
|
config.queues[name] or raise "Transport '#{name}' is not configured"
|
53
53
|
end
|
54
54
|
|
55
|
+
def publish flow = 'events', message = ''
|
56
|
+
raise "Waffle is not configured" unless Config.configured?
|
57
|
+
config.queues[:default].publish(flow, message)
|
58
|
+
end
|
59
|
+
|
60
|
+
def subscribe flow = '', &block
|
61
|
+
raise "Waffle is not configured" unless Config.configured?
|
62
|
+
config.queues[:default].subscribe(flow, &block)
|
63
|
+
end
|
64
|
+
|
55
65
|
def method_missing meth, *args
|
56
66
|
if Config.configured?
|
57
67
|
config.queues[:default].send(meth, *args)
|
@@ -11,7 +11,7 @@ module Waffle
|
|
11
11
|
exchange.publish(encoder.encode(message), :key => flow)
|
12
12
|
end
|
13
13
|
|
14
|
-
def subscribe_impl(flow = 'events')
|
14
|
+
def subscribe_impl(flow = 'events', &block)
|
15
15
|
if flow.is_a?(Array)
|
16
16
|
flow.each{|f| queue.bind(exchange, :key => f)}
|
17
17
|
else
|
@@ -19,7 +19,7 @@ module Waffle
|
|
19
19
|
end
|
20
20
|
|
21
21
|
queue.subscribe do |message|
|
22
|
-
|
22
|
+
block.call(message[:delivery_details][:routing_key], encoder.decode(message[:payload]))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
data/lib/waffle/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waffle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-10-
|
13
|
+
date: 2012-10-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -76,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
segments:
|
78
78
|
- 0
|
79
|
-
hash:
|
79
|
+
hash: 332701600399495824
|
80
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|