freddy 2.9.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.ruby-version +1 -1
- data/Gemfile.lock +6 -6
- data/freddy.gemspec +1 -1
- data/lib/freddy/consumers/respond_to_consumer.rb +7 -2
- data/lib/freddy/consumers/tap_into_consumer.rb +1 -3
- data/lib/freddy/version.rb +1 -1
- data/lib/freddy.rb +5 -3
- data/spec/freddy/consumers/respond_to_consumer_spec.rb +3 -1
- data/spec/integration/tap_into_with_group_spec.rb +0 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd0dbbf85e02a8b853785834898530095f86c076b79c6d8cb36a379ad133c6fa
|
4
|
+
data.tar.gz: a3fddc33ccebcf70a9482cd431d8706d533ab771daaee140afe6059dfe6de094
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae9cfaf81ca4b0428a31721df724e0ad9fea70f695c8e7cab2b53c1ee7070bfd835a1cb5ca53ea970f4b1eeed9d528d8bdcbf8e3d4b9d205bc2e1c2542320287
|
7
|
+
data.tar.gz: d8fdc01b0cff68c4cf6d9abcbe370964d585a042c88f1b761edd70ee8ffbf66976384510f15b401083e6bea63f3bed1811514b50c6a85d789e9fe398b23bee3a
|
data/.github/workflows/ci.yml
CHANGED
@@ -14,7 +14,7 @@ jobs:
|
|
14
14
|
ruby-version: ['3.2']
|
15
15
|
services:
|
16
16
|
rabbitmq:
|
17
|
-
image: public.ecr.aws/docker/library/rabbitmq:
|
17
|
+
image: public.ecr.aws/docker/library/rabbitmq:4.0
|
18
18
|
ports:
|
19
19
|
- 5672:5672
|
20
20
|
options: --health-cmd "rabbitmqctl node_health_check" --health-interval 10s --health-timeout 5s --health-retries 5
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.8
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
freddy (2.
|
5
|
-
bunny (~> 2.
|
4
|
+
freddy (2.10.0)
|
5
|
+
bunny (~> 2.24)
|
6
6
|
concurrent-ruby (~> 1.0)
|
7
7
|
oj (~> 3.6)
|
8
8
|
opentelemetry-api (~> 1.0)
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
amq-protocol (~> 2.3)
|
20
20
|
sorted_set (~> 1, >= 1.0.2)
|
21
21
|
coderay (1.1.3)
|
22
|
-
concurrent-ruby (1.3.
|
22
|
+
concurrent-ruby (1.3.5)
|
23
23
|
diff-lcs (1.4.4)
|
24
24
|
hamster (3.0.0)
|
25
25
|
concurrent-ruby (~> 1.0)
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
oj (3.16.10)
|
30
30
|
bigdecimal (>= 3.0)
|
31
31
|
ostruct (>= 0.2)
|
32
|
-
opentelemetry-api (1.
|
32
|
+
opentelemetry-api (1.5.0)
|
33
33
|
opentelemetry-common (0.19.6)
|
34
34
|
opentelemetry-api (~> 1.0)
|
35
35
|
opentelemetry-registry (0.2.0)
|
@@ -39,7 +39,7 @@ GEM
|
|
39
39
|
opentelemetry-common (~> 0.19.3)
|
40
40
|
opentelemetry-registry (~> 0.2)
|
41
41
|
opentelemetry-semantic_conventions
|
42
|
-
opentelemetry-semantic_conventions (1.
|
42
|
+
opentelemetry-semantic_conventions (1.11.0)
|
43
43
|
opentelemetry-api (~> 1.0)
|
44
44
|
ostruct (0.6.1)
|
45
45
|
parallel (1.26.3)
|
@@ -107,4 +107,4 @@ DEPENDENCIES
|
|
107
107
|
rubocop-rspec (~> 3.3)
|
108
108
|
|
109
109
|
BUNDLED WITH
|
110
|
-
2.
|
110
|
+
2.5.22
|
data/freddy.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
|
-
spec.add_dependency 'bunny', '~> 2.
|
20
|
+
spec.add_dependency 'bunny', '~> 2.24'
|
21
21
|
spec.add_dependency 'concurrent-ruby', '~> 1.0'
|
22
22
|
spec.add_dependency 'oj', '~> 3.6'
|
23
23
|
spec.add_dependency 'opentelemetry-api', '~> 1.0'
|
@@ -7,11 +7,12 @@ class Freddy
|
|
7
7
|
new(**attrs).consume(&)
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize(thread_pool:, destination:, channel:, handler_adapter_factory:)
|
10
|
+
def initialize(thread_pool:, destination:, channel:, handler_adapter_factory:, options:)
|
11
11
|
@consume_thread_pool = thread_pool
|
12
12
|
@destination = destination
|
13
13
|
@channel = channel
|
14
14
|
@handler_adapter_factory = handler_adapter_factory
|
15
|
+
@options = options
|
15
16
|
end
|
16
17
|
|
17
18
|
def consume
|
@@ -28,7 +29,7 @@ class Freddy
|
|
28
29
|
private
|
29
30
|
|
30
31
|
def consume_from_destination(&block)
|
31
|
-
@channel.queue(@destination).subscribe(manual_ack: true) do |delivery|
|
32
|
+
@channel.queue(@destination, durable: durable?).subscribe(manual_ack: true) do |delivery|
|
32
33
|
process_message(delivery, &block)
|
33
34
|
end
|
34
35
|
end
|
@@ -42,6 +43,10 @@ class Freddy
|
|
42
43
|
@channel.acknowledge(delivery.tag, false)
|
43
44
|
end
|
44
45
|
end
|
46
|
+
|
47
|
+
def durable?
|
48
|
+
@options.fetch(:durable, true)
|
49
|
+
end
|
45
50
|
end
|
46
51
|
end
|
47
52
|
end
|
@@ -12,8 +12,6 @@ class Freddy
|
|
12
12
|
@patterns = patterns
|
13
13
|
@channel = channel
|
14
14
|
@options = options
|
15
|
-
|
16
|
-
raise 'Do not use durable queues without specifying a group' if durable? && !group
|
17
15
|
end
|
18
16
|
|
19
17
|
def consume(&block)
|
@@ -70,7 +68,7 @@ class Freddy
|
|
70
68
|
end
|
71
69
|
|
72
70
|
def durable?
|
73
|
-
@options.fetch(:durable,
|
71
|
+
@options.fetch(:durable, true)
|
74
72
|
end
|
75
73
|
|
76
74
|
def on_exception
|
data/lib/freddy/version.rb
CHANGED
data/lib/freddy.rb
CHANGED
@@ -77,7 +77,7 @@ class Freddy
|
|
77
77
|
# handler.error(message: 'Can not do')
|
78
78
|
# end
|
79
79
|
# end
|
80
|
-
def respond_to(destination, &)
|
80
|
+
def respond_to(destination, options = {}, &)
|
81
81
|
@logger.info "Listening for requests on #{destination}"
|
82
82
|
|
83
83
|
channel = @connection.create_channel(prefetch: @prefetch_buffer_size)
|
@@ -89,6 +89,7 @@ class Freddy
|
|
89
89
|
destination: destination,
|
90
90
|
channel: channel,
|
91
91
|
handler_adapter_factory: handler_adapter_factory,
|
92
|
+
options: options,
|
92
93
|
&
|
93
94
|
)
|
94
95
|
end
|
@@ -107,8 +108,9 @@ class Freddy
|
|
107
108
|
# only one of the listeners in given group will receive a message. All
|
108
109
|
# listeners will receive a message if the group is not specified.
|
109
110
|
# @option options [Boolean] :durable
|
110
|
-
# Should the consumer queue be durable? Default is `
|
111
|
-
# be used only in combination with option `:group`.
|
111
|
+
# Should the consumer queue be durable? Default is `nil` - let server decide.
|
112
|
+
# This option can be used only in combination with option `:group`.
|
113
|
+
# Note that queues *must be durable* with "quorum" queue types.
|
112
114
|
# @option options [Boolean] :on_exception
|
113
115
|
# Defines consumer's behaviour when the callback fails to process a message
|
114
116
|
# and raises an exception. Can be one of `:ack`, `:reject` or `:requeue`.
|
@@ -6,7 +6,8 @@ describe Freddy::Consumers::RespondToConsumer do
|
|
6
6
|
thread_pool: thread_pool,
|
7
7
|
destination: destination,
|
8
8
|
channel: channel,
|
9
|
-
handler_adapter_factory: msg_handler_adapter_factory
|
9
|
+
handler_adapter_factory: msg_handler_adapter_factory,
|
10
|
+
options: options
|
10
11
|
)
|
11
12
|
end
|
12
13
|
|
@@ -17,6 +18,7 @@ describe Freddy::Consumers::RespondToConsumer do
|
|
17
18
|
let(:msg_handler_adapter) { Freddy::MessageHandlerAdapters::NoOpHandler.new }
|
18
19
|
let(:prefetch_buffer_size) { 2 }
|
19
20
|
let(:thread_pool) { Concurrent::FixedThreadPool.new(prefetch_buffer_size) }
|
21
|
+
let(:options) { { durable: false } }
|
20
22
|
|
21
23
|
after do
|
22
24
|
connection.close
|
@@ -11,11 +11,6 @@ describe 'Tapping into with group identifier' do
|
|
11
11
|
|
12
12
|
after { [deliverer, responder1, responder2].each(&:close) }
|
13
13
|
|
14
|
-
it 'raises an exception if option :durable is provided without group' do
|
15
|
-
expect { responder1.tap_into(destination, durable: true) }
|
16
|
-
.to raise_error(RuntimeError)
|
17
|
-
end
|
18
|
-
|
19
14
|
it 'receives a message once' do
|
20
15
|
msg_counter = Hamster::MutableSet[]
|
21
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Glia TechMovers
|
@@ -15,14 +15,14 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: '2.
|
18
|
+
version: '2.24'
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: '2.
|
25
|
+
version: '2.24'
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: concurrent-ruby
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|