amqp-boilerplate 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG
CHANGED
@@ -86,6 +86,7 @@ module AMQP
|
|
86
86
|
# aborted. See Ruby's exception inheritance hierarchy for a complete
|
87
87
|
# list of what is and what is not handled by this wrapper.
|
88
88
|
def handle_message_wrapper(metadata, payload)
|
89
|
+
AMQP::Boilerplate.logger.debug("[#{self.class}#handle_message_wrapper] Received message: #{payload}")
|
89
90
|
handle_message(metadata, payload)
|
90
91
|
rescue StandardError => e
|
91
92
|
message = <<-MSG
|
@@ -94,8 +94,12 @@ module AMQP
|
|
94
94
|
# @return [void]
|
95
95
|
def publish
|
96
96
|
message = send(self.class.amqp_boilerplate_message.to_sym)
|
97
|
-
|
98
|
-
|
97
|
+
if message
|
98
|
+
exchange.publish(message, self.class.amqp_boilerplate_options) do
|
99
|
+
AMQP::Boilerplate.logger.debug "[#{self.class}] Published message:\n#{message}"
|
100
|
+
end
|
101
|
+
else
|
102
|
+
AMQP::Boilerplate.logger.debug "[#{self.class}] Not publishing nil message"
|
99
103
|
end
|
100
104
|
end
|
101
105
|
|
@@ -40,6 +40,13 @@ describe AMQP::Boilerplate::Producer do
|
|
40
40
|
another_producer.publish
|
41
41
|
end
|
42
42
|
|
43
|
+
it "should only log nil messages" do
|
44
|
+
@nilproducer = NilProducer.new
|
45
|
+
AMQP::Boilerplate.logger.should_receive(:debug).with("[#{@nilproducer.class}] Not publishing nil message")
|
46
|
+
@nilproducer.publish
|
47
|
+
end
|
48
|
+
|
49
|
+
|
43
50
|
it "should pass options to AMQP::Exchange#publish" do
|
44
51
|
BarProducer.amqp({ :routing_key => "some.routing.key", :mandatory => true })
|
45
52
|
@exchange.should_receive(:publish).with(@producer.message, :routing_key => "some.routing.key", :mandatory => true)
|
data/spec/spec_helper.rb
CHANGED
@@ -28,6 +28,17 @@ class FooProducer
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
class NilProducer
|
32
|
+
extend AMQP::Boilerplate::Producer
|
33
|
+
|
34
|
+
amqp :routing_key => "yet.another.routing.key"
|
35
|
+
amqp_message :nil_message
|
36
|
+
|
37
|
+
def nil_message
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
31
42
|
class BarProducer
|
32
43
|
extend AMQP::Boilerplate::Producer
|
33
44
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amqp-boilerplate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Baselier
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-09-
|
19
|
+
date: 2011-09-26 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|