hermes_messenger_of_the_gods 2.3.1 → 2.3.2

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: 604daff161d76c0ebf41ab253989906c75c519aba9460282fc0644a3b3ed1cad
4
- data.tar.gz: 201cda28475512177767a542e0c13f15780431dbc8cfd45f324425bccecc090c
3
+ metadata.gz: 45e46de302befb016769708d8ec0e3d500e1dc3d83f3c2759eb37e089df3f54d
4
+ data.tar.gz: f678ce9af82af7750fce178b117c2e4fcc79a133d1e79d132d1ec9e29b9428c7
5
5
  SHA512:
6
- metadata.gz: 607884c3e2d370128952cd2a832686dbaeade734ae3580143a677715d388faf47dc620049252e07230c7f920e64db09a4b30b2c8ee08c85a4e5a2a667bd7595d
7
- data.tar.gz: a627e353104644dce6b85e0fb8dee0e6fe821742c2b29c3662140241c968cf0335991fe146143fd777460bd22b086f03dc1852249cdf64836f2d5b0b8816b071
6
+ metadata.gz: b4bfd0c75c08192c83866e6a5c744b9b4670a84858c93afcf24aab0af4ab8edb2ac2f7de7dc2d4dadc02eb27e906b34293a16d1fa0e5a75c35a35ba79618f30c
7
+ data.tar.gz: 64c3bdc04eaeebdfa0a73c0f7c0654f2274c2ef9a8f44f145b868b7805be971303a6b5e4df24b89522c7e348788dee68c67634e153b854820d93a72ae431a5c2
@@ -10,7 +10,7 @@ module HermesMessengerOfTheGods
10
10
  if instance_variable_defined?("@#{meth}")
11
11
  instance_variable_get("@#{meth}")
12
12
  else
13
- instance_variable_set("@#{meth}", default)
13
+ instance_variable_set("@#{meth}", default.respond_to?(:call) ? default.call() : default)
14
14
  end
15
15
  end
16
16
  end
@@ -25,5 +25,8 @@ module HermesMessengerOfTheGods
25
25
  attr_accessor_with_default :stub_dispatch, false
26
26
 
27
27
  attr_accessor_with_default :kill_on_consecutive_failures, false
28
+
29
+ attr_accessor_with_default :sqs_client, -> { Aws::SQS::Client.new }
30
+ attr_accessor_with_default :sns_client, -> { Aws::SNS::Client.new }
28
31
  end
29
32
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'aws-sdk-sns'
2
4
  require 'json'
3
5
 
@@ -5,15 +7,16 @@ module HermesMessengerOfTheGods
5
7
  module Endpoints
6
8
  class Sns < Base
7
9
  def sns_topic
8
- @sns_topic ||= Aws::SNS::Topic.new(self.endpoint,
9
- self.options[:client_options] || {}
10
- )
10
+ @sns_topic ||= Aws::SNS::Topic.new(endpoint,
11
+ {
12
+ client: HermesMessengerOfTheGods.configuration.sns_client
13
+ }.merge(options[:client_options] || {}))
11
14
  end
12
15
 
13
16
  def transmit(message, raw_message, dispatch_options = {})
14
17
  pub_opts = fetch_option(:publish_options, raw_message) || {}
15
18
 
16
- message = JSON.dump(message) if self.options[:jsonify]
19
+ message = JSON.dump(message) if options[:jsonify]
17
20
  sns_topic.publish(pub_opts.merge(dispatch_options, message: message))
18
21
  end
19
22
  end
@@ -16,7 +16,12 @@ module HermesMessengerOfTheGods
16
16
  end
17
17
 
18
18
  def poller
19
- @poller ||= Aws::SQS::QueuePoller.new(endpoint)
19
+ @poller ||= Aws::SQS::QueuePoller.new(
20
+ endpoint,
21
+ {
22
+ client: HermesMessengerOfTheGods.configuration.sqs_client
23
+ }.merge(options[:client_options] || {})
24
+ )
20
25
  end
21
26
 
22
27
  def inflight_messages
@@ -38,7 +43,7 @@ module HermesMessengerOfTheGods
38
43
  #
39
44
  # Break from polling
40
45
  def shutdown!
41
- say Logger::INFO, 'Shutdown command received'
46
+ warn 'Shutdown command received'
42
47
  @shutdown = true
43
48
  end
44
49
 
@@ -86,7 +91,12 @@ module HermesMessengerOfTheGods
86
91
  end
87
92
 
88
93
  def queue
89
- @queue ||= Aws::SQS::Queue.new(endpoint, options[:client_options] || {})
94
+ @queue ||= Aws::SQS::Queue.new(
95
+ endpoint,
96
+ {
97
+ client: HermesMessengerOfTheGods.configuration.sqs_client
98
+ }.merge(options[:client_options] || {})
99
+ )
90
100
  end
91
101
 
92
102
  def queue_data
@@ -1,3 +1,3 @@
1
1
  module HermesMessengerOfTheGods
2
- VERSION = '2.3.1'
2
+ VERSION = '2.3.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hermes_messenger_of_the_gods
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Malinconico
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-07-07 00:00:00.000000000 Z
12
+ date: 2022-07-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel