mimi-messaging-sqs_sns 0.4.0 → 0.4.1

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
  SHA1:
3
- metadata.gz: b740db8e4dab81e38d1b84ecd40c508a67d4c4c8
4
- data.tar.gz: b55b8188a57c5e0b8095ba133b27dad09f17f2a2
3
+ metadata.gz: f0919e38a4926e465f4b2017b98ce6b621a41f5b
4
+ data.tar.gz: f356e4552744757c4e6c77eb3eca359839d7d834
5
5
  SHA512:
6
- metadata.gz: c215ab899f4217ecd11e628f9739671d569da25cd2abd8ea3ce35572c5076b09941898f18b22f9d97926a9e29a93fb1729064919643ae0119a0a4f62c860b3d1
7
- data.tar.gz: 28b7ff63ec0db04041fc173a329bf39a3179d16f50e3d72133f776806fb95c2de5572ec51f8b97681a507645a05021fd01df9b2e1d3f36feae98601f8c8f39ee
6
+ metadata.gz: b45642dc502c2bf8e5debf230460594abef63fde87f4f029d5583fdb942965465581be65e0eb050781d2780453f1843644a9c0539849ef1e562062b3370cd47b
7
+ data.tar.gz: b5251902e1ac67cad8731f05fdd5a0fe1a7e32db70f4aa62a9f7a29bdb0a2de0c6ff56e82c0fa5b01fabb9d7438fb0411aa62390daf1afe0ceed1ce72c223562
@@ -78,6 +78,7 @@ module Mimi
78
78
  def start
79
79
  @sqs_client = Aws::SQS::Client.new(sqs_client_config)
80
80
  @sns_client = Aws::SNS::Client.new(sns_client_config)
81
+ check_availability!
81
82
  end
82
83
 
83
84
  def stop
@@ -248,6 +249,23 @@ module Mimi
248
249
  params.compact
249
250
  end
250
251
 
252
+ # Checks SQS and SNS clients availability
253
+ #
254
+ # @raise [Mimi::Messaging::ConnectionError]
255
+ #
256
+ def check_availability!
257
+ begin
258
+ queue_registry("test")
259
+ rescue StandardError => e
260
+ raise Mimi::Messaging::ConnectionError, "SQS connection is not available: #{e}"
261
+ end
262
+ begin
263
+ topic_registry("test")
264
+ rescue StandardError => e
265
+ raise Mimi::Messaging::ConnectionError, "SNS connection is not available: #{e}"
266
+ end
267
+ end
268
+
251
269
  # Creates a new queue
252
270
  #
253
271
  # @param queue_name [String] name of the topic to be created
@@ -300,6 +318,8 @@ module Mimi
300
318
  end
301
319
  rescue Aws::SQS::Errors::NonExistentQueue
302
320
  nil
321
+ rescue StandardError => e
322
+ raise Mimi::Messaging::ConnectionError, "Failed to get queue url '#{queue_name}': #{e}"
303
323
  end
304
324
 
305
325
  # Converts a topic or queue name to a fully qualified (with namespace)
@@ -3,7 +3,7 @@
3
3
  module Mimi
4
4
  module Messaging
5
5
  module SQS_SNS
6
- VERSION = "0.4.0"
6
+ VERSION = "0.4.1"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mimi-messaging-sqs_sns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Kukushkin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-13 00:00:00.000000000 Z
11
+ date: 2019-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mimi-messaging