freddy 2.3.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -2
- data/.rubocop.yml +3 -0
- data/.ruby-version +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +18 -19
- data/freddy.gemspec +2 -3
- data/lib/freddy/adapters/bunny_adapter.rb +7 -1
- data/lib/freddy/consumers/respond_to_consumer.rb +1 -1
- data/lib/freddy/consumers/tap_into_consumer.rb +1 -1
- data/lib/freddy/responder_handler.rb +2 -1
- data/lib/freddy/version.rb +1 -1
- data/lib/freddy.rb +3 -3
- data/spec/freddy/consumers/respond_to_consumer_spec.rb +1 -1
- data/spec/freddy/sync_response_container_spec.rb +2 -1
- data/spec/integration/tracing_spec.rb +2 -2
- data/spec/spec_helper.rb +0 -2
- metadata +16 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 395a8eab66f9ff57ce7f4703033598596c67ffb8febb2198c7bfed24c0579ad0
|
4
|
+
data.tar.gz: 5645a94b8e077a8f6a01ce96e6a5e546a1885abaf73b239804e9aab84a222789
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02a7990035a849971f4b68b1f52c15df2643334132b5d7a53aca33373c6e64c6b1cc1a46d28cdc32f83ab16199112e5de389ac05fde2d6a4b57303e64512073a
|
7
|
+
data.tar.gz: 8865375d8f5576e6b3303cf9ecdea515356df8b8219e16b4f4a76faf45437c1f8adab0d172f24671931d0841314f5d766e8b4a69d9f21381c28abb2a03ec3943
|
data/.github/workflows/ci.yml
CHANGED
@@ -11,7 +11,7 @@ jobs:
|
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
ruby-version: ['2.
|
14
|
+
ruby-version: ['2.7']
|
15
15
|
services:
|
16
16
|
rabbitmq:
|
17
17
|
image: rabbitmq
|
@@ -27,6 +27,6 @@ jobs:
|
|
27
27
|
with:
|
28
28
|
ruby-version: ${{ matrix.ruby-version }}
|
29
29
|
bundler-cache: true
|
30
|
-
cache-version:
|
30
|
+
cache-version: 2
|
31
31
|
- name: Run lint & tests
|
32
32
|
run: bundle exec rake
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
freddy (2.
|
4
|
+
freddy (2.5.0)
|
5
5
|
bunny (~> 2.11)
|
6
|
+
concurrent-ruby (~> 1.0)
|
6
7
|
oj (~> 3.6)
|
7
8
|
opentelemetry-api (~> 1.0.0.rc3)
|
8
9
|
opentelemetry-semantic_conventions (~> 1.0)
|
9
|
-
thread (~> 0.1)
|
10
10
|
zlib (~> 1.1)
|
11
11
|
|
12
12
|
GEM
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
hamster (3.0.0)
|
24
24
|
concurrent-ruby (~> 1.0)
|
25
25
|
method_source (1.0.0)
|
26
|
-
oj (3.13.
|
26
|
+
oj (3.13.14)
|
27
27
|
opentelemetry-api (1.0.0.rc3)
|
28
28
|
opentelemetry-common (0.19.1)
|
29
29
|
opentelemetry-api (~> 1.0.0.rc3)
|
@@ -36,16 +36,16 @@ GEM
|
|
36
36
|
opentelemetry-semantic_conventions
|
37
37
|
opentelemetry-semantic_conventions (1.6.0)
|
38
38
|
opentelemetry-api (~> 1.0.0.rc3)
|
39
|
-
parallel (1.
|
40
|
-
parser (3.
|
39
|
+
parallel (1.22.1)
|
40
|
+
parser (3.1.2.0)
|
41
41
|
ast (~> 2.4.1)
|
42
42
|
pry (0.14.1)
|
43
43
|
coderay (~> 1.1)
|
44
44
|
method_source (~> 1.0)
|
45
|
-
rainbow (3.
|
45
|
+
rainbow (3.1.1)
|
46
46
|
rake (13.0.6)
|
47
|
-
rbtree (0.4.
|
48
|
-
regexp_parser (2.
|
47
|
+
rbtree (0.4.5)
|
48
|
+
regexp_parser (2.5.0)
|
49
49
|
rexml (3.2.5)
|
50
50
|
rspec (3.10.0)
|
51
51
|
rspec-core (~> 3.10.0)
|
@@ -60,27 +60,26 @@ GEM
|
|
60
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
61
|
rspec-support (~> 3.10.0)
|
62
62
|
rspec-support (3.10.2)
|
63
|
-
rubocop (1.
|
63
|
+
rubocop (1.30.1)
|
64
64
|
parallel (~> 1.10)
|
65
|
-
parser (>= 3.
|
65
|
+
parser (>= 3.1.0.0)
|
66
66
|
rainbow (>= 2.2.2, < 4.0)
|
67
67
|
regexp_parser (>= 1.8, < 3.0)
|
68
|
-
rexml
|
69
|
-
rubocop-ast (>= 1.
|
68
|
+
rexml (>= 3.2.5, < 4.0)
|
69
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
70
70
|
ruby-progressbar (~> 1.7)
|
71
71
|
unicode-display_width (>= 1.4.0, < 3.0)
|
72
|
-
rubocop-ast (1.
|
73
|
-
parser (>= 3.
|
72
|
+
rubocop-ast (1.18.0)
|
73
|
+
parser (>= 3.1.1.0)
|
74
74
|
rubocop-rspec (2.4.0)
|
75
75
|
rubocop (~> 1.0)
|
76
76
|
rubocop-ast (>= 1.1.0)
|
77
77
|
ruby-progressbar (1.11.0)
|
78
|
-
set (1.0.
|
78
|
+
set (1.0.2)
|
79
79
|
sorted_set (1.0.3)
|
80
80
|
rbtree
|
81
81
|
set (~> 1.0)
|
82
|
-
|
83
|
-
unicode-display_width (2.0.0)
|
82
|
+
unicode-display_width (2.1.0)
|
84
83
|
zlib (1.1.0)
|
85
84
|
|
86
85
|
PLATFORMS
|
@@ -95,8 +94,8 @@ DEPENDENCIES
|
|
95
94
|
pry
|
96
95
|
rake
|
97
96
|
rspec
|
98
|
-
rubocop (~> 1.
|
97
|
+
rubocop (~> 1.30)
|
99
98
|
rubocop-rspec (~> 2.4)
|
100
99
|
|
101
100
|
BUNDLED WITH
|
102
|
-
2.
|
101
|
+
2.3.9
|
data/freddy.gemspec
CHANGED
@@ -11,20 +11,19 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = 'API for inter-application messaging supporting acknowledgements and request-response'
|
12
12
|
spec.license = 'MIT'
|
13
13
|
spec.homepage = 'https://github.com/salemove/freddy'
|
14
|
-
spec.required_ruby_version = '>= 2.
|
14
|
+
spec.required_ruby_version = '>= 2.7'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
18
|
spec.require_paths = ['lib']
|
20
19
|
|
21
20
|
spec.add_development_dependency 'bundler'
|
22
21
|
spec.add_development_dependency 'rake'
|
23
22
|
|
24
23
|
spec.add_dependency 'bunny', '~> 2.11'
|
24
|
+
spec.add_dependency 'concurrent-ruby', '~> 1.0'
|
25
25
|
spec.add_dependency 'oj', '~> 3.6'
|
26
26
|
spec.add_dependency 'opentelemetry-api', '~> 1.0.0.rc3'
|
27
27
|
spec.add_dependency 'opentelemetry-semantic_conventions', '~> 1.0'
|
28
|
-
spec.add_dependency 'thread', '~> 0.1'
|
29
28
|
spec.add_dependency 'zlib', '~> 1.1'
|
30
29
|
end
|
@@ -6,8 +6,14 @@ require 'forwardable'
|
|
6
6
|
class Freddy
|
7
7
|
module Adapters
|
8
8
|
class BunnyAdapter
|
9
|
+
DEFAULT_OPTIONS = {
|
10
|
+
connection_timeout: 5,
|
11
|
+
read_timeout: 5,
|
12
|
+
write_timeout: 5
|
13
|
+
}.freeze
|
14
|
+
|
9
15
|
def self.connect(config)
|
10
|
-
bunny = Bunny.new(config)
|
16
|
+
bunny = Bunny.new(DEFAULT_OPTIONS.merge(config))
|
11
17
|
bunny.start
|
12
18
|
new(bunny)
|
13
19
|
end
|
data/lib/freddy/version.rb
CHANGED
data/lib/freddy.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'json'
|
4
|
-
require '
|
4
|
+
require 'concurrent'
|
5
5
|
require 'securerandom'
|
6
6
|
require 'opentelemetry'
|
7
7
|
require 'opentelemetry/semantic_conventions'
|
@@ -85,7 +85,7 @@ class Freddy
|
|
85
85
|
handler_adapter_factory = MessageHandlerAdapters::Factory.new(producer)
|
86
86
|
|
87
87
|
Consumers::RespondToConsumer.consume(
|
88
|
-
thread_pool:
|
88
|
+
thread_pool: Concurrent::FixedThreadPool.new(@prefetch_buffer_size),
|
89
89
|
destination: destination,
|
90
90
|
channel: channel,
|
91
91
|
handler_adapter_factory: handler_adapter_factory,
|
@@ -128,7 +128,7 @@ class Freddy
|
|
128
128
|
@logger.debug "Tapping into messages that match #{pattern_or_patterns}"
|
129
129
|
|
130
130
|
Consumers::TapIntoConsumer.consume(
|
131
|
-
thread_pool:
|
131
|
+
thread_pool: Concurrent::FixedThreadPool.new(@prefetch_buffer_size),
|
132
132
|
patterns: Array(pattern_or_patterns),
|
133
133
|
channel: @connection.create_channel(prefetch: @prefetch_buffer_size),
|
134
134
|
options: options,
|
@@ -16,7 +16,7 @@ describe Freddy::Consumers::RespondToConsumer do
|
|
16
16
|
let(:msg_handler_adapter_factory) { double(for: msg_handler_adapter) }
|
17
17
|
let(:msg_handler_adapter) { Freddy::MessageHandlerAdapters::NoOpHandler.new }
|
18
18
|
let(:prefetch_buffer_size) { 2 }
|
19
|
-
let(:thread_pool) {
|
19
|
+
let(:thread_pool) { Concurrent::FixedThreadPool.new(prefetch_buffer_size) }
|
20
20
|
|
21
21
|
after do
|
22
22
|
connection.close
|
@@ -31,12 +31,13 @@ describe Freddy::SyncResponseContainer do
|
|
31
31
|
describe '#wait_for_response' do
|
32
32
|
let(:timeout) { 2 }
|
33
33
|
let(:response) { { msg: 'response' } }
|
34
|
-
let(:delivery) { OpenStruct.new(type: 'success') }
|
35
34
|
|
36
35
|
context 'when called after #call' do
|
37
36
|
let(:max_wait_time_in_seconds) { 0.5 }
|
38
37
|
|
39
38
|
before do
|
39
|
+
delivery = instance_double(Freddy::Delivery)
|
40
|
+
allow(delivery).to receive(:type).and_return('success')
|
40
41
|
container.call(response, delivery)
|
41
42
|
end
|
42
43
|
|
@@ -57,8 +57,8 @@ describe 'Tracing' do
|
|
57
57
|
freddy.deliver_with_response(destination, {})
|
58
58
|
names = exporter.finished_spans.map(&:name)
|
59
59
|
|
60
|
-
expect(names.any? { |name| name.include?('amq.gen-') }).to
|
61
|
-
expect(names.any? { |name| name.include?('(response queue)') }).to
|
60
|
+
expect(names.any? { |name| name.include?('amq.gen-') }).to be(false)
|
61
|
+
expect(names.any? { |name| name.include?('(response queue)') }).to be(true)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
data/spec/spec_helper.rb
CHANGED
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: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Glia TechMovers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,61 +53,61 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.11'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: concurrent-ruby
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: oj
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '3.6'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '3.6'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: opentelemetry-
|
84
|
+
name: opentelemetry-api
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 1.0.0.rc3
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.0.0.rc3
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: opentelemetry-semantic_conventions
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0
|
103
|
+
version: '1.0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: zlib
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -191,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
191
|
requirements:
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: '2.
|
194
|
+
version: '2.7'
|
195
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
196
|
requirements:
|
197
197
|
- - ">="
|
@@ -202,17 +202,4 @@ rubygems_version: 3.1.6
|
|
202
202
|
signing_key:
|
203
203
|
specification_version: 4
|
204
204
|
summary: API for inter-application messaging supporting acknowledgements and request-response
|
205
|
-
test_files:
|
206
|
-
- spec/.rubocop.yml
|
207
|
-
- spec/freddy/consumers/respond_to_consumer_spec.rb
|
208
|
-
- spec/freddy/error_response_spec.rb
|
209
|
-
- spec/freddy/freddy_spec.rb
|
210
|
-
- spec/freddy/message_handler_spec.rb
|
211
|
-
- spec/freddy/payload_spec.rb
|
212
|
-
- spec/freddy/responder_handler_spec.rb
|
213
|
-
- spec/freddy/sync_response_container_spec.rb
|
214
|
-
- spec/integration/concurrency_spec.rb
|
215
|
-
- spec/integration/reply_spec.rb
|
216
|
-
- spec/integration/tap_into_with_group_spec.rb
|
217
|
-
- spec/integration/tracing_spec.rb
|
218
|
-
- spec/spec_helper.rb
|
205
|
+
test_files: []
|