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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b139453f92c1d63b9c1480164bb5a31e88761621fb27f7614343b5d0b71f4638
4
- data.tar.gz: d253aa29930a718c890f026b83b51c0ed919f8b60b87bb8c4d02ce78128cb76d
3
+ metadata.gz: 5765ddd484db315254a41e9d4e445ca89d7fef1af2f24619de73bf1699f5ae5e
4
+ data.tar.gz: 7544a009754d7094524a6732a5ea40844abb324e14e97fcbaccb10c3f28f56aa
5
5
  SHA512:
6
- metadata.gz: 91c2138ab501dc84f508a040bd802d973949d8e49a1167f9f5353a2eaa208fd13530e7623be641418e898cfcb0809d228d95df3dfb0840db3ed32548d8d1a0f5
7
- data.tar.gz: 6746ec10356e0988b7fd8af41c226fd71fc7d2fecf20c9c75d8ca7d56025cf82ad619dc6081f6258773851f960245c0e47e1cfd2a5aae707ed5db6d62d2bc698
6
+ metadata.gz: 9e86c5de727b0d355fa2af8cb5bd3bc99da6f34d539d3f65f025012f47e9fa7517d91d571cb28d778f3dabcb3caa88498a5ad8ce1509e42f941f05d34d6eb985
7
+ data.tar.gz: 2cfedd5609d5c3b13c8beb42a0873798cc6ae6d5a4309a5bb15138b88e4e6a1f259689494a23254c70693d4f7f46f7e7d3a894cfff6d794c5747fecdf24aa4d8
data/.gitignore CHANGED
@@ -8,7 +8,7 @@ db
8
8
  .tddium*
9
9
  .DS_Store
10
10
  .jhw-cache
11
- **.orig
11
+ *.orig
12
12
  .rspec
13
13
  .bundle
14
14
  coverage
@@ -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
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Pwwka
2
- VERSION = '0.18.0'
2
+ VERSION = '0.19.0'
3
3
  end
@@ -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.18.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-05 00:00:00.000000000 Z
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