freddy 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/freddy.gemspec +1 -1
- data/lib/freddy/consumers.rb +6 -5
- data/lib/freddy/producers.rb +8 -0
- data/lib/freddy/producers/reply_producer.rb +1 -1
- data/lib/freddy/producers/send_and_forget_producer.rb +1 -1
- data/lib/freddy/producers/send_and_wait_response_producer.rb +7 -3
- data/spec/integration/logging_spec.rb +9 -2
- metadata +3 -5
- data/spec/freddy/consumers_spec.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80d6defa2644f870ae4f4ac27ea804b072f37da2
|
4
|
+
data.tar.gz: fc9f2e3229d2eb40c4344a424b4edc38ee26c233
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58b59901aa633d9c782699e0388aa9260f97e4bf3d0ea3af07d3bd1814997a125b30cfaf1edce53f4d2516cd2cb94e4386e6df4b38e345cecca7b4c56a23ce0c
|
7
|
+
data.tar.gz: 67ddf7fe5f6007f4dca7d7e757a4b1878622520165d300cc172b16ae2fb7f3c7fb3440cc6d9ff6bfdcfcdca6abe1995b51889d45457455cd0373e34691cd1cd5
|
data/freddy.gemspec
CHANGED
data/lib/freddy/consumers.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
class Freddy
|
2
2
|
module Consumers
|
3
3
|
def self.log_receive_event(logger, queue_name, delivery)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
logger.debug(
|
5
|
+
message: 'Received message',
|
6
|
+
queue: queue_name,
|
7
|
+
payload: delivery.payload,
|
8
|
+
correlation_id: delivery.correlation_id
|
9
|
+
)
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
data/lib/freddy/producers.rb
CHANGED
@@ -9,7 +9,7 @@ class Freddy
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def produce(destination, payload, properties)
|
12
|
-
@logger
|
12
|
+
Producers.log_send_event(@logger, payload, destination)
|
13
13
|
|
14
14
|
properties = properties.merge(
|
15
15
|
routing_key: destination, content_type: CONTENT_TYPE
|
@@ -10,7 +10,7 @@ class Freddy
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def produce(destination, payload, properties)
|
13
|
-
@logger
|
13
|
+
Producers.log_send_event(@logger, payload, destination)
|
14
14
|
|
15
15
|
properties = properties.merge(routing_key: destination, content_type: CONTENT_TYPE)
|
16
16
|
json_payload = Payload.dump(payload)
|
@@ -45,9 +45,13 @@ class Freddy
|
|
45
45
|
)
|
46
46
|
json_payload = Payload.dump(payload)
|
47
47
|
|
48
|
-
@logger.debug
|
49
|
-
|
50
|
-
|
48
|
+
@logger.debug(
|
49
|
+
message: 'Publishing request',
|
50
|
+
queue: destination,
|
51
|
+
payload: payload,
|
52
|
+
response_queue: @response_queue.name,
|
53
|
+
correlation_id: correlation_id
|
54
|
+
)
|
51
55
|
|
52
56
|
# Connection adapters handle thread safety for #publish themselves. No
|
53
57
|
# need to lock these.
|
@@ -24,14 +24,21 @@ describe 'Logging' do
|
|
24
24
|
it 'logs all consumed messages' do
|
25
25
|
expect(logger1).to have_received(:info).with(/Listening for requests on \S+/)
|
26
26
|
expect(logger1).to have_received(:debug).with(
|
27
|
-
|
27
|
+
message: 'Received message',
|
28
|
+
queue: destination,
|
29
|
+
payload: payload,
|
30
|
+
correlation_id: anything
|
28
31
|
)
|
29
32
|
end
|
30
33
|
|
31
34
|
it 'logs all produced messages' do
|
32
35
|
expect(logger2).to have_received(:debug).with(/Consuming messages on \S+/)
|
33
36
|
expect(logger2).to have_received(:debug).with(
|
34
|
-
|
37
|
+
message: 'Publishing request',
|
38
|
+
queue: destination,
|
39
|
+
payload: payload,
|
40
|
+
response_queue: anything,
|
41
|
+
correlation_id: anything
|
35
42
|
)
|
36
43
|
end
|
37
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Urmas Talimaa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,7 +136,6 @@ files:
|
|
136
136
|
- lib/freddy/timeout_error.rb
|
137
137
|
- lib/freddy/utils.rb
|
138
138
|
- spec/freddy/consumers/respond_to_consumer_spec.rb
|
139
|
-
- spec/freddy/consumers_spec.rb
|
140
139
|
- spec/freddy/error_response_spec.rb
|
141
140
|
- spec/freddy/freddy_spec.rb
|
142
141
|
- spec/freddy/message_handler_spec.rb
|
@@ -167,13 +166,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
166
|
version: '0'
|
168
167
|
requirements: []
|
169
168
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.4.
|
169
|
+
rubygems_version: 2.4.8
|
171
170
|
signing_key:
|
172
171
|
specification_version: 4
|
173
172
|
summary: API for inter-application messaging supporting acknowledgements and request-response
|
174
173
|
test_files:
|
175
174
|
- spec/freddy/consumers/respond_to_consumer_spec.rb
|
176
|
-
- spec/freddy/consumers_spec.rb
|
177
175
|
- spec/freddy/error_response_spec.rb
|
178
176
|
- spec/freddy/freddy_spec.rb
|
179
177
|
- spec/freddy/message_handler_spec.rb
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Freddy::Consumers do
|
4
|
-
describe '.log_receive_event' do
|
5
|
-
subject { described_class.log_receive_event(logger, queue_name, delivery) }
|
6
|
-
|
7
|
-
let(:queue_name) { 'salemove' }
|
8
|
-
let(:delivery) do
|
9
|
-
instance_double(Freddy::Delivery,
|
10
|
-
payload: {key: 'value'},
|
11
|
-
correlation_id: 'a1b2'
|
12
|
-
)
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'when configured with logasm logger' do
|
16
|
-
let(:logger) { logasm_class.new }
|
17
|
-
let(:logasm_class) { Class.new }
|
18
|
-
|
19
|
-
before do
|
20
|
-
stub_const('::Logasm', logasm_class)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'logs the received event' do
|
24
|
-
expect(logger).to receive(:debug).with('Received message',
|
25
|
-
queue: 'salemove', payload: {key: 'value'}, correlation_id: 'a1b2'
|
26
|
-
)
|
27
|
-
|
28
|
-
subject
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'when configured with regular logger' do
|
33
|
-
let(:logger) { Logger.new('/dev/null') }
|
34
|
-
|
35
|
-
it 'logs the received event' do
|
36
|
-
expect(logger).to receive(:debug)
|
37
|
-
.with('Received message on salemove with payload {:key=>"value"} with correlation_id a1b2')
|
38
|
-
|
39
|
-
subject
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|