hanami-events-cloud_pubsub 2.3.1 → 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: 359363457aee7a897b7deb7f0f99512b35e73f18a125e63afb006305013e17ef
4
- data.tar.gz: dc023884ef32591122fdc8ce2be13e620115ce8146a733176bba2bd79f37c602
3
+ metadata.gz: 525c7b860b08011b1ff556378976ea787b0741e310ce7c9a4c4365a9c00f903b
4
+ data.tar.gz: 9deb096c886933568164240c2a3bc16f79d6289cd9b50784ac54c71b73e3db5d
5
5
  SHA512:
6
- metadata.gz: 90ace734579e619e422d93c44bf0a863cc3192d296730c3ccdfa2cf54abdb9a8ff8f14e79b62b5643488c2c0c04dea6568476e399c597cf345b4bfe9a7d4780e
7
- data.tar.gz: eec416bde4dccbb7b69229aa30522fcb38842c0238422a4e3121e1fca6e6125e27a141be59c2c0183cd0db49fde663712d9228f308ca13be0e70bb59e2af8179
6
+ metadata.gz: 919bee723330e418ef523c9252de6c4740705bdeda96017fcc410fbb932b426f13ba46241090f3757cb3ea3e66accf4e4b3eb5233b64d8dd1512ab556b92a794
7
+ data.tar.gz: b4b9c6280d4e387fcc61bd2cd5f0a2185b816d19e330d3eb1fe26dc97dccc65f1c6e7428a3b06002f601d3bae3aad5e528eadff979835d4e4eafc2db59f4f353
data/Gemfile.lock CHANGED
@@ -8,9 +8,9 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- hanami-events-cloud_pubsub (2.3.1)
11
+ hanami-events-cloud_pubsub (2.4.0)
12
12
  dry-configurable (>= 0.8, < 0.10)
13
- google-cloud-pubsub (>= 0.38.1, < 1.2)
13
+ google-cloud-pubsub (>= 0.38.1, < 1.3)
14
14
  hanami-cli (~> 0.2)
15
15
  hanami-events (~> 0.2.0)
16
16
 
@@ -32,13 +32,15 @@ GEM
32
32
  dry-configurable (~> 0.1, >= 0.1.3)
33
33
  dry-core (0.4.9)
34
34
  concurrent-ruby (~> 1.0)
35
- faraday (0.17.1)
35
+ faraday (0.17.3)
36
36
  multipart-post (>= 1.2, < 3)
37
- google-cloud-core (1.4.1)
37
+ google-cloud-core (1.5.0)
38
38
  google-cloud-env (~> 1.0)
39
+ google-cloud-errors (~> 1.0)
39
40
  google-cloud-env (1.3.0)
40
41
  faraday (~> 0.11)
41
- google-cloud-pubsub (1.1.2)
42
+ google-cloud-errors (1.0.0)
43
+ google-cloud-pubsub (1.2.1)
42
44
  concurrent-ruby (~> 1.1)
43
45
  google-cloud-core (~> 1.2)
44
46
  google-gax (~> 1.8)
@@ -65,7 +67,7 @@ GEM
65
67
  multi_json (~> 1.11)
66
68
  os (>= 0.9, < 2.0)
67
69
  signet (~> 0.12)
68
- grpc (1.25.0)
70
+ grpc (1.26.0)
69
71
  google-protobuf (~> 3.8)
70
72
  googleapis-common-protos-types (~> 1.0)
71
73
  grpc-google-iam-v1 (0.6.9)
@@ -74,7 +76,7 @@ GEM
74
76
  hanami-cli (0.3.1)
75
77
  concurrent-ruby (~> 1.0)
76
78
  hanami-utils (~> 1.3)
77
- hanami-utils (1.3.5)
79
+ hanami-utils (1.3.6)
78
80
  concurrent-ruby (~> 1.0)
79
81
  transproc (~> 1.0)
80
82
  jaro_winkler (1.5.3)
@@ -91,7 +93,7 @@ GEM
91
93
  pry (0.12.2)
92
94
  coderay (~> 1.1.0)
93
95
  method_source (~> 0.9.0)
94
- public_suffix (4.0.1)
96
+ public_suffix (4.0.3)
95
97
  rainbow (3.0.0)
96
98
  rake (13.0.0)
97
99
  rly (0.2.3)
@@ -126,7 +128,7 @@ GEM
126
128
  json (>= 1.8, < 3)
127
129
  simplecov-html (~> 0.10.0)
128
130
  simplecov-html (0.10.2)
129
- transproc (1.1.0)
131
+ transproc (1.1.1)
130
132
  unicode-display_width (1.6.0)
131
133
 
132
134
  PLATFORMS
data/README.md CHANGED
@@ -32,6 +32,7 @@ Hanami.configure do
32
32
  config.namespace = :staging # optional
33
33
  config.auto_create_topics = false # optional
34
34
  config.auto_create_subscriptions = false # optional
35
+ config.on_shutdown = ->(adapter) { Analytics.flush } # optional
35
36
  config.error_handlers << ->(err, message) { MyErrorReporter.report(err) }
36
37
  # ...
37
38
  end
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
 
25
25
  spec.add_dependency 'dry-configurable', '>= 0.8', '< 0.10'
26
- spec.add_dependency 'google-cloud-pubsub', '>= 0.38.1', '< 1.2'
26
+ spec.add_dependency 'google-cloud-pubsub', '>= 0.38.1', '< 1.3'
27
27
  spec.add_dependency 'hanami-cli', '~> 0.2'
28
28
  spec.add_dependency 'hanami-events', '~> 0.2.0'
29
29
 
@@ -63,6 +63,8 @@ module Hanami
63
63
  Middleware::Logging.new,
64
64
  Middleware::AutoRetry.new
65
65
  )
66
+
67
+ setting :on_shutdown_handlers, [], reader: true
66
68
  end
67
69
  end
68
70
  end
@@ -42,6 +42,8 @@ module Hanami
42
42
  sleep_for_a_bit
43
43
  adapter.flush_messages
44
44
  adapter.listeners.each(&:wait)
45
+ handle_on_shutdown
46
+
45
47
  self
46
48
  end
47
49
 
@@ -104,6 +106,20 @@ module Hanami
104
106
  def sleep_for_a_bit
105
107
  sleep @sleep_time
106
108
  end
109
+
110
+ def handle_on_shutdown
111
+ return if CloudPubsub.on_shutdown_handlers.empty?
112
+
113
+ logger.info('Calling custom on_shutdown handler')
114
+
115
+ CloudPubsub.on_shutdown_handlers.each do |handler|
116
+ begin
117
+ handler.call(adapter)
118
+ rescue StandardError => e
119
+ logger.warn("Shutdown handler failed (#{e.message})")
120
+ end
121
+ end
122
+ end
107
123
  end
108
124
  end
109
125
  end
@@ -3,7 +3,7 @@
3
3
  module Hanami
4
4
  module Events
5
5
  module CloudPubsub
6
- VERSION = '2.3.1'
6
+ VERSION = '2.4.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-events-cloud_pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-18 00:00:00.000000000 Z
11
+ date: 2020-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: 0.38.1
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '1.2'
42
+ version: '1.3'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: 0.38.1
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '1.2'
52
+ version: '1.3'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: hanami-cli
55
55
  requirement: !ruby/object:Gem::Requirement