osbourne 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/osbourne/install/templates/osbourne_initializer_template.template +3 -0
- data/lib/osbourne.rb +4 -0
- data/lib/osbourne/config/shared_configs.rb +4 -0
- data/lib/osbourne/test/mock_pubsub.rb +3 -2
- data/lib/osbourne/topic.rb +7 -5
- data/lib/osbourne/version.rb +1 -1
- data/lib/osbourne/worker_base.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bc30cb744a8d1f61944e06d22366941ac38cb47a403b7326bcae0d42675354b
|
4
|
+
data.tar.gz: 763818934b5e711f4d490c79a5e0c23ac9be6cbd405db01d2ff84d566bc89965
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4747c0fc40a18ec8f4c09dd1bb6f524642d6237f595bf2467313d39dc650886a292e0c546cef3f2ea68c1bb7d360b9336ce24fcec16315dd8a2d4c413b275fc
|
7
|
+
data.tar.gz: fa40de44493aa86981222b685da16e9a291e07906a6d743b5e0d85572dee996d502bd6bd75ead9f9d1d5e59036374bf0ab66d56b6d6496f1db2e2cafd9deb03e
|
@@ -13,6 +13,9 @@ Osbourne.configure do |config|
|
|
13
13
|
# sent to the dead letter queue
|
14
14
|
# config.max_retry_count = 5
|
15
15
|
|
16
|
+
# The prefix to be used on queues and topics. Useful for environment separation
|
17
|
+
# config.prefix = Rails.env
|
18
|
+
|
16
19
|
# Amount of time each worker will wait between attempting to fetch messages
|
17
20
|
# config.sleep_time = 15.seconds
|
18
21
|
|
data/lib/osbourne.rb
CHANGED
@@ -6,10 +6,11 @@ module Osbourne
|
|
6
6
|
class MockPubsub
|
7
7
|
class << self
|
8
8
|
def mock_publish(topic, message)
|
9
|
+
prefixed_topic = Osbourne.prefixer(topic)
|
9
10
|
parsed_message = parse(message)
|
10
11
|
Osbourne::WorkerBase.descendants.each do |worker|
|
11
|
-
msg = Osbourne::Test::Message.new(topic:
|
12
|
-
worker.new.process(msg) if worker.config[:topic_names].include?
|
12
|
+
msg = Osbourne::Test::Message.new(topic: prefixed_topic, body: parsed_message)
|
13
|
+
worker.new.process(msg) if worker.config[:topic_names].include? prefixed_topic
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
data/lib/osbourne/topic.rb
CHANGED
@@ -4,8 +4,10 @@ module Osbourne
|
|
4
4
|
class Topic
|
5
5
|
include Services::SNS
|
6
6
|
attr_reader :name
|
7
|
+
attr_reader :prefixed_name
|
7
8
|
def initialize(name)
|
8
9
|
@name = name
|
10
|
+
@prefixed_name = Osbourne.prefixer(name)
|
9
11
|
arn
|
10
12
|
end
|
11
13
|
|
@@ -17,7 +19,7 @@ module Osbourne
|
|
17
19
|
parsed_message = parse(message)
|
18
20
|
return if Osbourne.test_mode?
|
19
21
|
|
20
|
-
Osbourne.logger.info "[PUB] TOPIC: `#{
|
22
|
+
Osbourne.logger.info "[PUB] TOPIC: `#{prefixed_name}` MESSAGE: `#{parsed_message}`"
|
21
23
|
sns.publish(topic_arn: arn, message: parsed_message)
|
22
24
|
end
|
23
25
|
|
@@ -26,14 +28,14 @@ module Osbourne
|
|
26
28
|
def ensure_topic
|
27
29
|
return if Osbourne.test_mode?
|
28
30
|
|
29
|
-
Osbourne.logger.debug "Ensuring topic `#{
|
30
|
-
Osbourne.cache.fetch("osbourne_existing_topic_arn_for_#{
|
31
|
-
sns.create_topic(name:
|
31
|
+
Osbourne.logger.debug "Ensuring topic `#{prefixed_name}` exists"
|
32
|
+
Osbourne.cache.fetch("osbourne_existing_topic_arn_for_#{prefixed_name}", ex: 1.minute) do
|
33
|
+
sns.create_topic(name: prefixed_name).topic_arn
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
35
37
|
def subscriptions_cache_key
|
36
|
-
"existing_sqs_subscriptions_for_#{
|
38
|
+
"existing_sqs_subscriptions_for_#{prefixed_name}"
|
37
39
|
end
|
38
40
|
|
39
41
|
def parse(message)
|
data/lib/osbourne/version.rb
CHANGED
data/lib/osbourne/worker_base.rb
CHANGED
@@ -81,8 +81,8 @@ module Osbourne
|
|
81
81
|
dead_letter_queue: true,
|
82
82
|
max_retry_count: Osbourne.max_retry_count)
|
83
83
|
self.config = {
|
84
|
-
topic_names: Array(topics),
|
85
|
-
queue_name: queue_name,
|
84
|
+
topic_names: Array(topics).map {|tp| Osbourne.prefixer(tp) },
|
85
|
+
queue_name: Osbourne.prefixer(queue_name),
|
86
86
|
max_batch_size: max_batch_size,
|
87
87
|
max_wait: max_wait,
|
88
88
|
threads: threads,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osbourne
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|