pheme 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pheme/queue_poller.rb +3 -3
- data/lib/pheme/topic_publisher.rb +1 -0
- data/lib/pheme/version.rb +1 -1
- data/spec/queue_poller_spec.rb +14 -0
- data/spec/topic_publisher_spec.rb +16 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46433ad750c6060d267dc7124847580d107274c9
|
4
|
+
data.tar.gz: 11cf1262b1da8a5e590eef8ef023a88734f1874f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b309d7c66b7ed47901c4748476e5ac428513dfb89b531c64f1936f0f48e1dfc555acc3fbc586372c25592015d9998f6e6bfd6c236a21d8504bc26e11afa8b919
|
7
|
+
data.tar.gz: f9c7870ba06f05d0d01dbc35f09e6d392cb5d4ebd272d0ef7fc7ef938516d52862517875322aafe03390441d02829148160f7ddc8315b7136f5924cfcfe742c9
|
data/lib/pheme/queue_poller.rb
CHANGED
@@ -3,15 +3,15 @@ module Pheme
|
|
3
3
|
attr_accessor :queue_url, :queue_poller, :connection_pool_block, :poller_configuration
|
4
4
|
|
5
5
|
def initialize(queue_url:, connection_pool_block: false, poller_configuration: {})
|
6
|
+
raise ArgumentError, "must specify non-nil queue_url" unless queue_url.present?
|
6
7
|
@queue_url = queue_url
|
7
8
|
@queue_poller = Aws::SQS::QueuePoller.new(queue_url)
|
8
9
|
@connection_pool_block = connection_pool_block
|
9
|
-
@poller_configuration =
|
10
|
+
@poller_configuration = {
|
10
11
|
wait_time_seconds: 10, # amount of time a long polling receive call can wait for a mesage before receiving a empty response (which will trigger another polling request)
|
11
12
|
idle_timeout: 20, # disconnects poller after 20 seconds of idle time
|
12
|
-
visibility_timeout: 30, # length of time in seconds that this message will not be visible to other receiving components
|
13
13
|
skip_delete: true, # manually delete messages
|
14
|
-
})
|
14
|
+
}.merge(poller_configuration || {})
|
15
15
|
end
|
16
16
|
|
17
17
|
def poll
|
data/lib/pheme/version.rb
CHANGED
data/spec/queue_poller_spec.rb
CHANGED
@@ -10,6 +10,20 @@ describe Pheme::QueuePoller do
|
|
10
10
|
allow(Aws::SQS::QueuePoller).to receive(:new) { poller }
|
11
11
|
end
|
12
12
|
|
13
|
+
describe ".new" do
|
14
|
+
context "when initialized with valid params" do
|
15
|
+
it "does not raise an error" do
|
16
|
+
expect { ExampleQueuePoller.new(queue_url: "queue_url") }.not_to raise_error
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "when initialized with a nil queue_url" do
|
21
|
+
it "raises an ArgumentError" do
|
22
|
+
expect { ExampleQueuePoller.new(queue_url: nil) }.to raise_error(ArgumentError)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
13
27
|
describe "#poll" do
|
14
28
|
before(:each) do
|
15
29
|
module ActiveRecord
|
@@ -1,8 +1,23 @@
|
|
1
1
|
describe Pheme::TopicPublisher do
|
2
2
|
before(:each) { use_default_configuration! }
|
3
|
-
|
3
|
+
|
4
|
+
describe ".new" do
|
5
|
+
context "when initialized with valid params" do
|
6
|
+
it "does not raise an error" do
|
7
|
+
expect { ExamplePublisher.new(topic_arn: "arn:aws:sns:whatever") }.not_to raise_error
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
context "when initialized with a nil topic_arn" do
|
12
|
+
it "raises an ArgumentError" do
|
13
|
+
expect { ExamplePublisher.new(topic_arn: nil) }.to raise_error(ArgumentError)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
4
17
|
|
5
18
|
describe "#publish_events" do
|
19
|
+
subject { ExamplePublisher.new(topic_arn: "arn:aws:sns:whatever") }
|
20
|
+
|
6
21
|
it "publishes the correct events" do
|
7
22
|
expect(Pheme.configuration.sns_client).to receive(:publish).with({
|
8
23
|
topic_arn: "arn:aws:sns:whatever",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pheme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Graham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -144,3 +144,4 @@ test_files:
|
|
144
144
|
- spec/support/example_queue_poller.rb
|
145
145
|
- spec/topic_publisher_spec.rb
|
146
146
|
- spec/version_spec.rb
|
147
|
+
has_rdoc:
|