freddy 2.6.0 → 2.7.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/publish.yml +1 -2
- data/Gemfile.lock +6 -6
- data/lib/freddy/consumers/tap_into_consumer.rb +6 -2
- data/lib/freddy/delivery.rb +4 -0
- data/lib/freddy/version.rb +1 -1
- data/lib/freddy.rb +10 -2
- data/spec/integration/tap_into_with_exchange_spec.rb +44 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: addf621163f5d1faf987bf6ab91d027a538631303543833e1aea8946d3bc0e0b
|
4
|
+
data.tar.gz: 22d6eddbd383a2d7b7b46a4e69b2f78b1a0ba6e8a803a1c8b13be7a8be9d3948
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 569d91cfe03265013e808bd1847c023b5e307e0411b12ef8113e54e3c471953f21f7a0ed3603c81513cf4a4d628447347d1d582e808b14cdd7f58ef5c8d5023c
|
7
|
+
data.tar.gz: bdeb3e75486d8f026e30d1766db834f2d6f7bad2e788f8d74eaaa836e428d02f56101d1e67b8ec5697cbd04ed9b891e6b98933d5c483c17e200b64cf8b877afd
|
@@ -15,8 +15,7 @@ jobs:
|
|
15
15
|
|
16
16
|
|
17
17
|
- name: Release Gem
|
18
|
-
uses: discourse/publish-rubygems-action@
|
18
|
+
uses: discourse/publish-rubygems-action@ec5415e2cc3509a5cc8c4eef9499cf3fb05f8391
|
19
19
|
env:
|
20
|
-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
21
20
|
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
22
21
|
RELEASE_COMMAND: rake release
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
freddy (2.
|
4
|
+
freddy (2.7.0)
|
5
5
|
bunny (~> 2.11)
|
6
6
|
concurrent-ruby (~> 1.0)
|
7
7
|
oj (~> 3.6)
|
@@ -14,16 +14,16 @@ GEM
|
|
14
14
|
specs:
|
15
15
|
amq-protocol (2.3.2)
|
16
16
|
ast (2.4.2)
|
17
|
-
bunny (2.
|
17
|
+
bunny (2.22.0)
|
18
18
|
amq-protocol (~> 2.3, >= 2.3.1)
|
19
19
|
sorted_set (~> 1, >= 1.0.2)
|
20
20
|
coderay (1.1.3)
|
21
|
-
concurrent-ruby (1.
|
21
|
+
concurrent-ruby (1.2.2)
|
22
22
|
diff-lcs (1.4.4)
|
23
23
|
hamster (3.0.0)
|
24
24
|
concurrent-ruby (~> 1.0)
|
25
25
|
method_source (1.0.0)
|
26
|
-
oj (3.
|
26
|
+
oj (3.15.0)
|
27
27
|
opentelemetry-api (1.1.0)
|
28
28
|
opentelemetry-common (0.19.6)
|
29
29
|
opentelemetry-api (~> 1.0)
|
@@ -34,7 +34,7 @@ GEM
|
|
34
34
|
opentelemetry-common (~> 0.19.3)
|
35
35
|
opentelemetry-registry (~> 0.2)
|
36
36
|
opentelemetry-semantic_conventions
|
37
|
-
opentelemetry-semantic_conventions (1.
|
37
|
+
opentelemetry-semantic_conventions (1.10.0)
|
38
38
|
opentelemetry-api (~> 1.0)
|
39
39
|
parallel (1.22.1)
|
40
40
|
parser (3.1.2.0)
|
@@ -44,7 +44,7 @@ GEM
|
|
44
44
|
method_source (~> 1.0)
|
45
45
|
rainbow (3.1.1)
|
46
46
|
rake (13.0.6)
|
47
|
-
rbtree (0.4.
|
47
|
+
rbtree (0.4.6)
|
48
48
|
regexp_parser (2.5.0)
|
49
49
|
rexml (3.2.5)
|
50
50
|
rspec (3.10.0)
|
@@ -29,7 +29,7 @@ class Freddy
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def create_queue
|
32
|
-
topic_exchange = @channel.topic(
|
32
|
+
topic_exchange = @channel.topic(exchange_name)
|
33
33
|
|
34
34
|
queue =
|
35
35
|
if group
|
@@ -48,7 +48,7 @@ class Freddy
|
|
48
48
|
def process_message(_queue, delivery)
|
49
49
|
@consume_thread_pool.post do
|
50
50
|
delivery.in_span do
|
51
|
-
yield delivery.payload, delivery.routing_key
|
51
|
+
yield delivery.payload, delivery.routing_key, delivery.timestamp
|
52
52
|
@channel.acknowledge(delivery.tag)
|
53
53
|
end
|
54
54
|
rescue StandardError
|
@@ -76,6 +76,10 @@ class Freddy
|
|
76
76
|
def on_exception
|
77
77
|
@options.fetch(:on_exception, :ack)
|
78
78
|
end
|
79
|
+
|
80
|
+
def exchange_name
|
81
|
+
@options.fetch(:exchange_name, Freddy::FREDDY_TOPIC_EXCHANGE_NAME)
|
82
|
+
end
|
79
83
|
end
|
80
84
|
end
|
81
85
|
end
|
data/lib/freddy/delivery.rb
CHANGED
data/lib/freddy/version.rb
CHANGED
data/lib/freddy.rb
CHANGED
@@ -117,8 +117,16 @@ class Freddy
|
|
117
117
|
# `:ack` simply acknowledges the message and re-raises the exception. `:reject`
|
118
118
|
# rejects the message without requeueing it. `:requeue` rejects the message with
|
119
119
|
# `requeue` flag.
|
120
|
-
#
|
121
|
-
#
|
120
|
+
# @option options [String] :exchange_name
|
121
|
+
# Exchange to bind to. Default is `freddy-topic`.
|
122
|
+
#
|
123
|
+
# @yield [message] Yields received message to the block.
|
124
|
+
# @yieldparam [Object] payload
|
125
|
+
# Yields the received message's payload.
|
126
|
+
# @yieldparam [String] routing_key
|
127
|
+
# Yields the received message's routing key.
|
128
|
+
# @yieldparam [Time] timestamp
|
129
|
+
# Yields received message's timestamp.
|
122
130
|
#
|
123
131
|
# @return [#shutdown]
|
124
132
|
#
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Tapping into with exchange identifier' do
|
4
|
+
let(:freddy) { Freddy.build(logger, **config) }
|
5
|
+
|
6
|
+
let(:connection) { Freddy::Adapters.determine.connect(config) }
|
7
|
+
let(:topic) { 'test_topic_exchange' }
|
8
|
+
let(:channel) { connection.create_channel }
|
9
|
+
let(:message_payload) { { test: 'test' }.to_json }
|
10
|
+
let(:expected_payload) { { test: 'test' } }
|
11
|
+
let(:publish_timestamp) { Time.now.to_i }
|
12
|
+
|
13
|
+
after do
|
14
|
+
connection.close
|
15
|
+
freddy.close
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'receives message' do
|
19
|
+
freddy.tap_into('pattern.*', exchange_name: topic) do |payload, _routing_key, timestamp|
|
20
|
+
@received_payload = payload
|
21
|
+
@received_timestamp = timestamp
|
22
|
+
end
|
23
|
+
|
24
|
+
channel.topic(topic).publish(message_payload, { routing_key: 'pattern.random', timestamp: publish_timestamp })
|
25
|
+
|
26
|
+
wait_for { @received_payload }
|
27
|
+
wait_for { @received_timestamp }
|
28
|
+
|
29
|
+
expect(@received_payload).to eq(expected_payload)
|
30
|
+
expect(@received_timestamp.to_i).to eq(publish_timestamp)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'receives message with nil timestamp when timestamp is not published' do
|
34
|
+
received_timestamp = 0
|
35
|
+
freddy.tap_into('pattern.*', exchange_name: topic) do |_payload, _routing_key, timestamp|
|
36
|
+
received_timestamp = timestamp
|
37
|
+
end
|
38
|
+
|
39
|
+
channel.topic(topic).publish(message_payload, { routing_key: 'pattern.random' })
|
40
|
+
default_sleep
|
41
|
+
|
42
|
+
expect(received_timestamp).to eq(nil)
|
43
|
+
end
|
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: 2.
|
4
|
+
version: 2.7.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: 2023-
|
11
|
+
date: 2023-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- spec/freddy/sync_response_container_spec.rb
|
177
177
|
- spec/integration/concurrency_spec.rb
|
178
178
|
- spec/integration/reply_spec.rb
|
179
|
+
- spec/integration/tap_into_with_exchange_spec.rb
|
179
180
|
- spec/integration/tap_into_with_group_spec.rb
|
180
181
|
- spec/integration/tracing_spec.rb
|
181
182
|
- spec/spec_helper.rb
|