pwwka 0.18.0 → 0.19.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/.gitignore +1 -1
- data/lib/pwwka/channel_connector.rb +2 -1
- data/lib/pwwka/receiver.rb +1 -1
- data/lib/pwwka/transmitter.rb +1 -1
- data/lib/pwwka/version.rb +1 -1
- data/spec/unit/channel_connector_spec.rb +19 -0
- data/spec/unit/receiver_spec.rb +17 -0
- data/spec/unit/transmitter_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5765ddd484db315254a41e9d4e445ca89d7fef1af2f24619de73bf1699f5ae5e
|
4
|
+
data.tar.gz: 7544a009754d7094524a6732a5ea40844abb324e14e97fcbaccb10c3f28f56aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e86c5de727b0d355fa2af8cb5bd3bc99da6f34d539d3f65f025012f47e9fa7517d91d571cb28d778f3dabcb3caa88498a5ad8ce1509e42f941f05d34d6eb985
|
7
|
+
data.tar.gz: 2cfedd5609d5c3b13c8beb42a0873798cc6ae6d5a4309a5bb15138b88e4e6a1f259689494a23254c70693d4f7f46f7e7d3a894cfff6d794c5747fecdf24aa4d8
|
data/.gitignore
CHANGED
@@ -8,9 +8,10 @@ module Pwwka
|
|
8
8
|
# The channel_connector starts the connection to the message_bus
|
9
9
|
# so it should only be instantiated by a method that has a strategy
|
10
10
|
# for closing the connection
|
11
|
-
def initialize(prefetch: nil)
|
11
|
+
def initialize(prefetch: nil, connection_name: nil)
|
12
12
|
@configuration = Pwwka.configuration
|
13
13
|
connection_options = {automatically_recover: false}.merge(configuration.options)
|
14
|
+
connection_options = {client_properties: {connection_name: connection_name}}.merge(connection_options) if connection_name
|
14
15
|
@connection = Bunny.new(configuration.rabbit_mq_host,
|
15
16
|
connection_options)
|
16
17
|
@connection.start
|
data/lib/pwwka/receiver.rb
CHANGED
@@ -12,7 +12,7 @@ module Pwwka
|
|
12
12
|
def initialize(queue_name, routing_key, prefetch: Pwwka.configuration.default_prefetch)
|
13
13
|
@queue_name = queue_name
|
14
14
|
@routing_key = routing_key
|
15
|
-
@channel_connector = ChannelConnector.new(prefetch: prefetch)
|
15
|
+
@channel_connector = ChannelConnector.new(prefetch: prefetch, connection_name: "c: #{queue_name}")
|
16
16
|
@channel = @channel_connector.channel
|
17
17
|
@topic_exchange = @channel_connector.topic_exchange
|
18
18
|
end
|
data/lib/pwwka/transmitter.rb
CHANGED
@@ -26,7 +26,7 @@ module Pwwka
|
|
26
26
|
attr_reader :channel_connector
|
27
27
|
|
28
28
|
def initialize
|
29
|
-
@channel_connector = ChannelConnector.new
|
29
|
+
@channel_connector = ChannelConnector.new(connection_name: "p: #{Pwwka.configuration.app_id}")
|
30
30
|
end
|
31
31
|
|
32
32
|
# Send an important message that must go through. This method allows any raised exception
|
data/lib/pwwka/version.rb
CHANGED
@@ -26,6 +26,25 @@ describe Pwwka::ChannelConnector do
|
|
26
26
|
|
27
27
|
described_class.new
|
28
28
|
end
|
29
|
+
|
30
|
+
it "sets a connection_name if configured to do so" do
|
31
|
+
expect(Bunny).to receive(:new).with(
|
32
|
+
/amqp:\/\/guest:guest@localhost:/,
|
33
|
+
{:client_properties=>{:connection_name=>"test_connection"},
|
34
|
+
:automatically_recover=>false,
|
35
|
+
:allow_delayed=>true})
|
36
|
+
|
37
|
+
described_class.new(connection_name: "test_connection")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "only contains default options if none provided" do
|
41
|
+
expect(Bunny).to receive(:new).with(
|
42
|
+
/amqp:\/\/guest:guest@localhost:/,
|
43
|
+
{:automatically_recover=>false, :allow_delayed=>true})
|
44
|
+
|
45
|
+
described_class.new
|
46
|
+
end
|
47
|
+
|
29
48
|
end
|
30
49
|
|
31
50
|
describe "raise_if_delayed_not_allowed" do
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
describe Pwwka::Receiver do
|
4
|
+
describe "#new" do
|
5
|
+
let(:channel_connector) { double(Pwwka::ChannelConnector)}
|
6
|
+
|
7
|
+
before do
|
8
|
+
allow(Pwwka::ChannelConnector).to receive(:new).with(prefetch: nil, connection_name: "c: test_queue_name").and_return(channel_connector)
|
9
|
+
allow(channel_connector).to receive(:channel)
|
10
|
+
allow(channel_connector).to receive(:topic_exchange)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should set the connection_name" do
|
14
|
+
Pwwka::Receiver.new("test_queue_name", "test.routing.key")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -20,7 +20,7 @@ describe Pwwka::Transmitter do
|
|
20
20
|
allow(logger).to receive(:info)
|
21
21
|
allow(logger).to receive(:warn)
|
22
22
|
allow(logger).to receive(:error)
|
23
|
-
allow(Pwwka::ChannelConnector).to receive(:new).and_return(channel_connector)
|
23
|
+
allow(Pwwka::ChannelConnector).to receive(:new).with(connection_name: "p: MyAwesomeApp").and_return(channel_connector)
|
24
24
|
allow(channel_connector).to receive(:connection_close)
|
25
25
|
allow(topic_exchange).to receive(:publish)
|
26
26
|
allow(delayed_exchange).to receive(:publish)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwwka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stitch Fix Engineering
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2018-12-
|
18
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: bunny
|
@@ -264,6 +264,7 @@ files:
|
|
264
264
|
- spec/unit/logging_spec.rb
|
265
265
|
- spec/unit/message_queuer_spec.rb
|
266
266
|
- spec/unit/queue_resque_job_handler_spec.rb
|
267
|
+
- spec/unit/receiver_spec.rb
|
267
268
|
- spec/unit/send_message_async_job_spec.rb
|
268
269
|
- spec/unit/test_handler_message_spec.rb
|
269
270
|
- spec/unit/transmitter_spec.rb
|
@@ -311,6 +312,7 @@ test_files:
|
|
311
312
|
- spec/unit/logging_spec.rb
|
312
313
|
- spec/unit/message_queuer_spec.rb
|
313
314
|
- spec/unit/queue_resque_job_handler_spec.rb
|
315
|
+
- spec/unit/receiver_spec.rb
|
314
316
|
- spec/unit/send_message_async_job_spec.rb
|
315
317
|
- spec/unit/test_handler_message_spec.rb
|
316
318
|
- spec/unit/transmitter_spec.rb
|