propono 0.7.0 → 0.8.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 +8 -8
- data/.travis.yml +5 -0
- data/CHANGELOG.md +5 -1
- data/lib/propono.rb +4 -0
- data/lib/propono/services/publisher.rb +4 -1
- data/lib/propono/services/queue_listener.rb +0 -1
- data/lib/propono/version.rb +1 -1
- data/propono.gemspec +1 -0
- data/test/services/publisher_test.rb +17 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDQ0NzcyNzRmNTc5YjM2N2RjYTRiY2FjMDZmOGFiMTZiZTg1NmZiNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGY0OTNiNDExMjk4M2U2OTk2NjNkNzNmNWViYzlhMGU5MTM0NjJjNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODJiYTFjMGYyMjNlMjhkNzU0NGQ3ZTVkYTc2MGU0ZjQ0Y2IxMTU3OTRmMDZh
|
10
|
+
ZDc1MDg1NWZhYjM5YzE4MzUyMDgwOWRlM2ExOTVhNzBlMGE3MTk3MGNlYWFh
|
11
|
+
ZGYwNWI1ZTg0OWVkNGE2YjZmM2M3ZTI1YjhiNTczMTYzNGNhMjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWI4ZDIxYzRjNGVkYzk3ZjdlZDBlNDZhOGMyMjg2MWY2ZTU1MDczOGM5NWRl
|
14
|
+
NWIyZTZkOGNmYmI4MDFiODYwZTY5MTZhZDk0NzMwMjc0ZDJiNGZlNzMwOTli
|
15
|
+
ZDcyMWQyNzhiMTZjMjZhZTJkNzk5NjYzYjA3ZjU2NDE5MGFhMDQ=
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/propono.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
#
|
3
3
|
# Propono is a pub/sub gem built on top of Amazon Web Services (AWS). It uses Simple Notification Service (SNS) and Simple Queue Service (SQS) to seamlessly pass messages throughout your infrastructure.
|
4
4
|
|
5
|
+
require "thread/pool"
|
6
|
+
|
5
7
|
require "propono/version"
|
6
8
|
require 'propono/propono_error'
|
7
9
|
require 'propono/logger'
|
@@ -26,6 +28,8 @@ require "propono/services/tcp_listener"
|
|
26
28
|
# It uses Simple Notification Service (SNS) and Simple Queue Service (SQS)
|
27
29
|
# to seamlessly pass messages throughout your infrastructure.
|
28
30
|
module Propono
|
31
|
+
|
32
|
+
WORKER_POOL = Thread.pool(4)
|
29
33
|
|
30
34
|
# Propono configuration settings.
|
31
35
|
#
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'socket'
|
2
|
+
require 'thread/future'
|
2
3
|
|
3
4
|
module Propono
|
4
5
|
class PublisherError < ProponoError
|
@@ -31,7 +32,9 @@ module Propono
|
|
31
32
|
def publish_via_sns
|
32
33
|
topic = TopicCreator.find_or_create(topic_id)
|
33
34
|
msg = message.is_a?(String) ? message : message.to_json
|
34
|
-
|
35
|
+
Thread.future(WORKER_POOL) do
|
36
|
+
sns.publish(topic.arn, msg)
|
37
|
+
end
|
35
38
|
end
|
36
39
|
|
37
40
|
def publish_via_udp
|
@@ -23,7 +23,6 @@ module Propono
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def read_messages
|
26
|
-
#response = sqs.receive_message( queue_url, options = { 'MaxNumberOfMessages' => 10 } )
|
27
26
|
response = sqs.receive_message( queue_url, {'MaxNumberOfMessages' => 10} )
|
28
27
|
messages = response.body['Message']
|
29
28
|
if messages.empty?
|
data/lib/propono/version.rb
CHANGED
data/propono.gemspec
CHANGED
@@ -49,7 +49,7 @@ module Propono
|
|
49
49
|
sns.expects(:publish).with(topic_arn, message)
|
50
50
|
publisher = Publisher.new(topic, message)
|
51
51
|
publisher.stubs(sns: sns)
|
52
|
-
publisher.send(:publish_via_sns)
|
52
|
+
~publisher.send(:publish_via_sns)
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_publish_via_sns_should_accept_a_hash_for_message
|
@@ -64,7 +64,22 @@ module Propono
|
|
64
64
|
sns.expects(:publish).with(topic_arn, message.to_json)
|
65
65
|
publisher = Publisher.new(topic, message)
|
66
66
|
publisher.stubs(sns: sns)
|
67
|
-
publisher.send(:publish_via_sns)
|
67
|
+
~publisher.send(:publish_via_sns)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_publish_via_sns_should_return_future_of_the_sns_response
|
71
|
+
topic = "topic123"
|
72
|
+
message = "message123"
|
73
|
+
topic_arn = "arn123"
|
74
|
+
topic = Topic.new(topic_arn)
|
75
|
+
|
76
|
+
TopicCreator.stubs(find_or_create: topic)
|
77
|
+
|
78
|
+
sns = mock()
|
79
|
+
sns.expects(:publish).with(topic_arn, message).returns(:response)
|
80
|
+
publisher = Publisher.new(topic, message)
|
81
|
+
publisher.stubs(sns: sns)
|
82
|
+
assert_same :response, publisher.send(:publish_via_sns).value
|
68
83
|
end
|
69
84
|
|
70
85
|
def test_publish_via_sns_should_propogate_exception_on_topic_creation_error
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: propono
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MalcyL
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 1.15.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: thread
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.1.1
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.1.1
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: bundler
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|