hanami-events-cloud_pubsub 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Gemfile.lock +35 -32
- data/hanami-events-cloud_pubsub.gemspec +3 -3
- data/lib/hanami/events/cloud_pubsub.rb +3 -2
- data/lib/hanami/events/cloud_pubsub/middleware/{auto_acknowledge.rb → auto_retry.rb} +12 -2
- data/lib/hanami/events/cloud_pubsub/version.rb +1 -1
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b786cbc6b85949059720828605ac3263973bda40906a06d0c879984e1f293e9c
|
4
|
+
data.tar.gz: 3850d7de58d0da55bd0c975b1cae04ee0fd218a47e9a1da08791e823361da33e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baa476518202b7e5e71c589c16b1c31f49a5b2f8a04c90cc697ce59740fc6b5de04bf7dfa0d7c6b73169ea5d6a8bc840246c20060b9cd6f2e18ae7e21047c00a
|
7
|
+
data.tar.gz: 37fe813d6d91d89bf79d3b6e16fa40973a8bdd9f2ce2f7d0aea7bc3fe07ba91367c08e75b1d71af8fef09adeff0d2ef114bc31a88df7accf0815bc88c16964e5
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,94 +1,97 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/hanami/events
|
3
|
-
revision:
|
3
|
+
revision: 59a36d22b75ea045fa8994f4f660a02c0901f8b2
|
4
4
|
specs:
|
5
|
-
hanami-events (0.1
|
5
|
+
hanami-events (0.2.1)
|
6
6
|
dry-container (~> 0.6)
|
7
7
|
|
8
8
|
PATH
|
9
9
|
remote: .
|
10
10
|
specs:
|
11
|
-
hanami-events-cloud_pubsub (
|
12
|
-
dry-configurable (~> 0.
|
13
|
-
google-cloud-pubsub (~> 0.
|
11
|
+
hanami-events-cloud_pubsub (2.0.0)
|
12
|
+
dry-configurable (~> 0.8.0)
|
13
|
+
google-cloud-pubsub (~> 0.34.0)
|
14
14
|
hanami-cli (>= 0.2.0)
|
15
|
-
hanami-events (~> 0)
|
15
|
+
hanami-events (~> 0.2.0)
|
16
16
|
|
17
17
|
GEM
|
18
18
|
remote: https://rubygems.org/
|
19
19
|
specs:
|
20
|
-
addressable (2.
|
20
|
+
addressable (2.6.0)
|
21
21
|
public_suffix (>= 2.0.2, < 4.0)
|
22
22
|
ast (2.4.0)
|
23
23
|
coderay (1.1.2)
|
24
|
-
concurrent-ruby (1.
|
24
|
+
concurrent-ruby (1.1.4)
|
25
25
|
diff-lcs (1.3)
|
26
26
|
docile (1.3.1)
|
27
|
-
dry-configurable (0.
|
27
|
+
dry-configurable (0.8.2)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
|
-
|
29
|
+
dry-core (~> 0.4, >= 0.4.7)
|
30
|
+
dry-container (0.7.0)
|
30
31
|
concurrent-ruby (~> 1.0)
|
31
32
|
dry-configurable (~> 0.1, >= 0.1.3)
|
32
|
-
|
33
|
+
dry-core (0.4.7)
|
34
|
+
concurrent-ruby (~> 1.0)
|
35
|
+
faraday (0.15.4)
|
33
36
|
multipart-post (>= 1.2, < 3)
|
34
|
-
google-cloud-core (1.
|
37
|
+
google-cloud-core (1.3.0)
|
35
38
|
google-cloud-env (~> 1.0)
|
36
39
|
google-cloud-env (1.0.5)
|
37
40
|
faraday (~> 0.11)
|
38
|
-
google-cloud-pubsub (0.
|
41
|
+
google-cloud-pubsub (0.34.1)
|
39
42
|
concurrent-ruby (~> 1.0)
|
40
43
|
google-cloud-core (~> 1.2)
|
41
44
|
google-gax (~> 1.3)
|
42
45
|
grpc-google-iam-v1 (~> 0.6.9)
|
43
|
-
google-gax (1.
|
46
|
+
google-gax (1.5.0)
|
44
47
|
google-protobuf (~> 3.2)
|
45
48
|
googleapis-common-protos (>= 1.3.5, < 2.0)
|
46
|
-
googleauth (
|
49
|
+
googleauth (>= 0.6.2, < 0.10.0)
|
47
50
|
grpc (>= 1.7.2, < 2.0)
|
48
51
|
rly (~> 0.2.3)
|
49
|
-
google-protobuf (3.
|
50
|
-
googleapis-common-protos (1.3.
|
52
|
+
google-protobuf (3.7.0)
|
53
|
+
googleapis-common-protos (1.3.8)
|
51
54
|
google-protobuf (~> 3.0)
|
52
55
|
googleapis-common-protos-types (~> 1.0)
|
53
56
|
grpc (~> 1.0)
|
54
|
-
googleapis-common-protos-types (1.0.
|
57
|
+
googleapis-common-protos-types (1.0.3)
|
55
58
|
google-protobuf (~> 3.0)
|
56
|
-
googleauth (0.
|
59
|
+
googleauth (0.8.0)
|
57
60
|
faraday (~> 0.12)
|
58
61
|
jwt (>= 1.4, < 3.0)
|
59
62
|
memoist (~> 0.16)
|
60
63
|
multi_json (~> 1.11)
|
61
64
|
os (>= 0.9, < 2.0)
|
62
65
|
signet (~> 0.7)
|
63
|
-
grpc (1.
|
66
|
+
grpc (1.19.0)
|
64
67
|
google-protobuf (~> 3.1)
|
65
68
|
googleapis-common-protos-types (~> 1.0.0)
|
66
69
|
grpc-google-iam-v1 (0.6.9)
|
67
70
|
googleapis-common-protos (>= 1.3.1, < 2.0)
|
68
71
|
grpc (~> 1.0)
|
69
|
-
hanami-cli (0.3.
|
72
|
+
hanami-cli (0.3.1)
|
70
73
|
concurrent-ruby (~> 1.0)
|
71
74
|
hanami-utils (~> 1.3)
|
72
|
-
hanami-utils (1.3.
|
75
|
+
hanami-utils (1.3.1)
|
73
76
|
concurrent-ruby (~> 1.0)
|
74
77
|
transproc (~> 1.0)
|
75
|
-
json (2.
|
78
|
+
json (2.2.0)
|
76
79
|
jwt (2.1.0)
|
77
80
|
memoist (0.16.0)
|
78
|
-
method_source (0.9.
|
81
|
+
method_source (0.9.2)
|
79
82
|
multi_json (1.13.1)
|
80
83
|
multipart-post (2.0.0)
|
81
84
|
os (1.0.0)
|
82
|
-
parallel (1.
|
83
|
-
parser (2.
|
85
|
+
parallel (1.14.0)
|
86
|
+
parser (2.6.0.0)
|
84
87
|
ast (~> 2.4.0)
|
85
88
|
powerpack (0.1.2)
|
86
|
-
pry (0.
|
89
|
+
pry (0.12.2)
|
87
90
|
coderay (~> 1.1.0)
|
88
91
|
method_source (~> 0.9.0)
|
89
92
|
public_suffix (3.0.3)
|
90
93
|
rainbow (3.0.0)
|
91
|
-
rake (12.3.
|
94
|
+
rake (12.3.2)
|
92
95
|
rly (0.2.3)
|
93
96
|
rspec (3.8.0)
|
94
97
|
rspec-core (~> 3.8.0)
|
@@ -96,7 +99,7 @@ GEM
|
|
96
99
|
rspec-mocks (~> 3.8.0)
|
97
100
|
rspec-core (3.8.0)
|
98
101
|
rspec-support (~> 3.8.0)
|
99
|
-
rspec-expectations (3.8.
|
102
|
+
rspec-expectations (3.8.2)
|
100
103
|
diff-lcs (>= 1.2.0, < 2.0)
|
101
104
|
rspec-support (~> 3.8.0)
|
102
105
|
rspec-mocks (3.8.0)
|
@@ -121,8 +124,8 @@ GEM
|
|
121
124
|
json (>= 1.8, < 3)
|
122
125
|
simplecov-html (~> 0.10.0)
|
123
126
|
simplecov-html (0.10.2)
|
124
|
-
transproc (1.0.
|
125
|
-
unicode-display_width (1.
|
127
|
+
transproc (1.0.3)
|
128
|
+
unicode-display_width (1.5.0)
|
126
129
|
|
127
130
|
PLATFORMS
|
128
131
|
ruby
|
@@ -138,4 +141,4 @@ DEPENDENCIES
|
|
138
141
|
simplecov
|
139
142
|
|
140
143
|
BUNDLED WITH
|
141
|
-
1.
|
144
|
+
1.17.1
|
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_dependency 'dry-configurable', '~> 0.
|
26
|
-
spec.add_dependency 'google-cloud-pubsub', '~> 0.
|
25
|
+
spec.add_dependency 'dry-configurable', '~> 0.8.0'
|
26
|
+
spec.add_dependency 'google-cloud-pubsub', '~> 0.34.0'
|
27
27
|
spec.add_dependency 'hanami-cli', '>= 0.2.0'
|
28
|
-
spec.add_dependency 'hanami-events', '~> 0'
|
28
|
+
spec.add_dependency 'hanami-events', '~> 0.2.0'
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
31
31
|
spec.add_development_dependency 'rake', '~> 12.3'
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'concurrent/async'
|
3
4
|
require 'hanami/events'
|
4
5
|
require 'hanami/events/cloud_pubsub/version'
|
5
6
|
require 'hanami/events/cloud_pubsub/middleware/stack'
|
6
7
|
require 'hanami/events/cloud_pubsub/middleware/logging'
|
7
|
-
require 'hanami/events/cloud_pubsub/middleware/
|
8
|
+
require 'hanami/events/cloud_pubsub/middleware/auto_retry'
|
8
9
|
require 'hanami/events/cloud_pubsub/runner'
|
9
10
|
require 'google/cloud/pubsub'
|
10
11
|
require 'dry-configurable'
|
@@ -57,7 +58,7 @@ module Hanami
|
|
57
58
|
|
58
59
|
setting :middleware, Middleware::Stack.new(
|
59
60
|
Middleware::Logging.new,
|
60
|
-
Middleware::
|
61
|
+
Middleware::AutoRetry.new
|
61
62
|
)
|
62
63
|
end
|
63
64
|
end
|
@@ -6,7 +6,7 @@ module Hanami
|
|
6
6
|
# Middleware
|
7
7
|
module Middleware
|
8
8
|
# Middleware used for automatically acknowledging messages
|
9
|
-
class
|
9
|
+
class AutoRetry
|
10
10
|
def initialize(logger: nil)
|
11
11
|
@logger = logger
|
12
12
|
end
|
@@ -28,9 +28,14 @@ module Hanami
|
|
28
28
|
def ack_or_reject(message, succeeded, failed)
|
29
29
|
id = message.message_id
|
30
30
|
|
31
|
-
if succeeded
|
31
|
+
if succeeded
|
32
32
|
message.acknowledge!
|
33
33
|
logger.debug "Message(#{id}) was acknowledged"
|
34
|
+
elsif failed
|
35
|
+
seconds = calculate_backoff_seconds(message)
|
36
|
+
success = message.modify_ack_deadline!(seconds)
|
37
|
+
msg = "added #{success ? seconds : 0} seconds of delay to ack deadline"
|
38
|
+
logger.debug "Message(#{id}) failed, #{msg}" if success
|
34
39
|
else
|
35
40
|
message.reject!
|
36
41
|
logger.warn "Message(#{id}) was terminated from outside, rescheduling"
|
@@ -40,6 +45,11 @@ module Hanami
|
|
40
45
|
def logger
|
41
46
|
@logger || CloudPubsub.logger
|
42
47
|
end
|
48
|
+
|
49
|
+
def calculate_backoff_seconds(_message)
|
50
|
+
# Figure out a way to keep track of retries
|
51
|
+
60
|
52
|
+
end
|
43
53
|
end
|
44
54
|
end
|
45
55
|
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:
|
4
|
+
version: 2.0.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:
|
11
|
+
date: 2019-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.8.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: google-cloud-pubsub
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.34.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.34.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hanami-cli
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.2.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.2.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,7 +142,7 @@ files:
|
|
142
142
|
- lib/hanami/events/cloud_pubsub/health_check_server.rb
|
143
143
|
- lib/hanami/events/cloud_pubsub/integration.rb
|
144
144
|
- lib/hanami/events/cloud_pubsub/listener.rb
|
145
|
-
- lib/hanami/events/cloud_pubsub/middleware/
|
145
|
+
- lib/hanami/events/cloud_pubsub/middleware/auto_retry.rb
|
146
146
|
- lib/hanami/events/cloud_pubsub/middleware/logging.rb
|
147
147
|
- lib/hanami/events/cloud_pubsub/middleware/stack.rb
|
148
148
|
- lib/hanami/events/cloud_pubsub/register.rb
|
@@ -170,8 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
- !ruby/object:Gem::Version
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
|
-
|
174
|
-
rubygems_version: 2.7.7
|
173
|
+
rubygems_version: 3.0.3
|
175
174
|
signing_key:
|
176
175
|
specification_version: 4
|
177
176
|
summary: Google Cloud Pub/Sub adapter for the hanami-events gem
|