eventq 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8077af791afb09d09e8f641e1a947ab907e5e4727bd20f083cdbc76c98f04db8
4
- data.tar.gz: 9184d31e7c07eb435b7044ebe50d3b35d886b765ec42ba120b039abbae0ff163
3
+ metadata.gz: c8a55998f78ac404d51a4278b44b802a23d1b9c322cad2a29b8c1e94950ad4fa
4
+ data.tar.gz: 92dddbaed323bf8f803a07adc483376a2b255c43ce015c6a5ed59c3b81081478
5
5
  SHA512:
6
- metadata.gz: 67c758c56a2efa1d035d415c7b3de24fa2cf3e4ac84505354877740a9ba4486717f0491c24141cb51e037bb23ce2572458826a690bb8753d5553474c4cd2118b
7
- data.tar.gz: 2d68117be96eaafa6a49063f9706f51efb79e21e1abb0c12e4139077a24fa0eec6571a07df064597dba01d6820966a6089ca00d057e154f435228d058425b5bc
6
+ metadata.gz: 45465979d1c58fd6cb0a4f54752a7cb4278c002465cbb12e3f4ee8b6e98538d9f65ab35e15d69cb41ae88d28f00fbc275bb73b7bc45be777e3c576d07384143f
7
+ data.tar.gz: 7011679b0e5c08fc6a0468067816e6bf136ce24900e411d5e1b1afedd53180c92c454dc9696874a2fad3f0a4d30dcd9a829a55fe4e9fb557b519f33abfec33c8
@@ -28,6 +28,10 @@ module EventQ
28
28
  attributes = default_queue_attributes(q, queue_arn)
29
29
  @client.sqs(queue_region).set_queue_attributes(attributes)
30
30
 
31
+ # skip subscribe if subscription for given queue/topic already exists
32
+ # this fixes a localstack issue: https://github.com/localstack/localstack/issues/933
33
+ return true if existing_subscription?(queue_arn, topic_arn)
34
+
31
35
  @client.sns(topic_region).subscribe(
32
36
  topic_arn: topic_arn,
33
37
  protocol: 'sqs',
@@ -72,6 +76,12 @@ module EventQ
72
76
  ]
73
77
  }'
74
78
  end
79
+
80
+ # check if there is an existing subscription for the given queue/topic
81
+ def existing_subscription?(queue_arn, topic_arn)
82
+ subscriptions = @client.sns.list_subscriptions.subscriptions
83
+ subscriptions.any? { |subscription| subscription.topic_arn == topic_arn && subscription.endpoint == queue_arn }
84
+ end
75
85
  end
76
86
  end
77
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventq
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SageOne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-24 00:00:00.000000000 Z
11
+ date: 2019-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler