google-cloud-pubsub 2.15.5 → 2.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/google/cloud/pubsub/convert.rb +1 -1
- data/lib/google/cloud/pubsub/flow_controller.rb +0 -2
- data/lib/google/cloud/pubsub/message.rb +2 -3
- data/lib/google/cloud/pubsub/project.rb +9 -0
- data/lib/google/cloud/pubsub/service.rb +17 -9
- data/lib/google/cloud/pubsub/subscriber/stream.rb +1 -1
- data/lib/google/cloud/pubsub/version.rb +1 -1
- data/lib/google/cloud/pubsub.rb +18 -15
- data/lib/google-cloud-pubsub.rb +3 -2
- metadata +6 -160
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9baf526a8b94705a0743ca0614706046c014c11e9823a255aef8de94eb927962
|
4
|
+
data.tar.gz: b90d14a0b11cbfd8685ed11d631d61ba27032d4a91ee71f5ae245e505c3e755b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dae5a2eedf9edece6daf5225271961853a1c43490ed64f44ba9f0d2e747cec8eb2943111be2ea608961313697c597e555ceb93fee795e59d992562f0c5fca01a
|
7
|
+
data.tar.gz: 5e394bb76ccade24fcb11ac80055cb62fe41f8872e48a2de39ace663e4815aafcee3b977af20dd0ff80f71ad9083c703ef5a3dca4f6606d894f8bf37744c2c1a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 2.17.0 (2024-03-07)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Update minimum supported Ruby version to 2.7 ([#25298](https://github.com/googleapis/google-cloud-ruby/issues/25298))
|
8
|
+
|
9
|
+
### 2.16.0 (2024-01-25)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Support for universe_domain ([#24437](https://github.com/googleapis/google-cloud-ruby/issues/24437))
|
14
|
+
|
3
15
|
### 2.15.5 (2023-11-06)
|
4
16
|
|
5
17
|
#### Bug Fixes
|
@@ -69,7 +69,7 @@ module Google
|
|
69
69
|
data_bytes = String(data).dup.force_encoding(Encoding::ASCII_8BIT).freeze
|
70
70
|
|
71
71
|
# Convert attributes to strings to match the protobuf definition
|
72
|
-
attributes =
|
72
|
+
attributes = attributes.to_h { |k, v| [String(k), String(v)] }
|
73
73
|
|
74
74
|
# Ordering Key must always be a string
|
75
75
|
ordering_key = String(ordering_key).freeze
|
@@ -84,7 +84,6 @@ module Google
|
|
84
84
|
|
85
85
|
protected
|
86
86
|
|
87
|
-
# rubocop:disable Style/IdenticalConditionalBranches
|
88
87
|
# rubocop:disable Style/GuardClause
|
89
88
|
|
90
89
|
def acquire_or_wait message_size
|
@@ -117,7 +116,6 @@ module Google
|
|
117
116
|
end
|
118
117
|
end
|
119
118
|
|
120
|
-
# rubocop:enable Style/IdenticalConditionalBranches
|
121
119
|
# rubocop:enable Style/GuardClause
|
122
120
|
|
123
121
|
def is_new_and_others_wait? waiter
|
@@ -62,7 +62,7 @@ module Google
|
|
62
62
|
# This can be used to publish several messages in bulk.
|
63
63
|
def initialize data = nil, attributes = {}
|
64
64
|
# Convert attributes to strings to match the protobuf definition
|
65
|
-
attributes =
|
65
|
+
attributes = attributes.to_h { |k, v| [String(k), String(v)] }
|
66
66
|
|
67
67
|
@grpc = Google::Cloud::PubSub::V1::PubsubMessage.new(
|
68
68
|
data: String(data).dup.force_encoding(Encoding::ASCII_8BIT),
|
@@ -81,8 +81,7 @@ module Google
|
|
81
81
|
# Optional attributes for the message.
|
82
82
|
def attributes
|
83
83
|
return @grpc.attributes.to_h if @grpc.attributes.respond_to? :to_h
|
84
|
-
|
85
|
-
Hash[@grpc.attributes.to_a]
|
84
|
+
@grpc.attributes.to_a.to_h
|
86
85
|
end
|
87
86
|
|
88
87
|
##
|
@@ -37,14 +37,17 @@ module Google
|
|
37
37
|
# value to be replaced for unit testing.
|
38
38
|
attr_accessor :client_id
|
39
39
|
|
40
|
+
attr_reader :universe_domain
|
41
|
+
|
40
42
|
##
|
41
43
|
# Creates a new Service instance.
|
42
|
-
def initialize project, credentials, host: nil, timeout: nil
|
44
|
+
def initialize project, credentials, host: nil, timeout: nil, universe_domain: nil
|
43
45
|
@project = project
|
44
46
|
@credentials = credentials
|
45
47
|
@host = host
|
46
48
|
@timeout = timeout
|
47
49
|
@client_id = SecureRandom.uuid.freeze
|
50
|
+
@universe_domain = universe_domain || ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"] || "googleapis.com"
|
48
51
|
end
|
49
52
|
|
50
53
|
def subscriber
|
@@ -53,6 +56,7 @@ module Google
|
|
53
56
|
config.credentials = credentials if credentials
|
54
57
|
override_client_config_timeouts config if timeout
|
55
58
|
config.endpoint = host if host
|
59
|
+
config.universe_domain = universe_domain
|
56
60
|
config.lib_name = "gccl"
|
57
61
|
config.lib_version = Google::Cloud::PubSub::VERSION
|
58
62
|
config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
|
@@ -66,6 +70,7 @@ module Google
|
|
66
70
|
config.credentials = credentials if credentials
|
67
71
|
override_client_config_timeouts config if timeout
|
68
72
|
config.endpoint = host if host
|
73
|
+
config.universe_domain = universe_domain
|
69
74
|
config.lib_name = "gccl"
|
70
75
|
config.lib_version = Google::Cloud::PubSub::VERSION
|
71
76
|
config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
|
@@ -75,13 +80,15 @@ module Google
|
|
75
80
|
|
76
81
|
def iam
|
77
82
|
return mocked_iam if mocked_iam
|
78
|
-
@iam ||=
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
83
|
+
@iam ||= begin
|
84
|
+
iam = (@publisher || @subscriber || @schemas || subscriber).iam_policy_client
|
85
|
+
iam.configure do |config|
|
86
|
+
override_client_config_timeouts config if timeout
|
87
|
+
config.lib_name = "gccl"
|
88
|
+
config.lib_version = Google::Cloud::PubSub::VERSION
|
89
|
+
config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
|
90
|
+
end
|
91
|
+
iam
|
85
92
|
end
|
86
93
|
end
|
87
94
|
attr_accessor :mocked_iam
|
@@ -92,6 +99,7 @@ module Google
|
|
92
99
|
config.credentials = credentials if credentials
|
93
100
|
override_client_config_timeouts config if timeout
|
94
101
|
config.endpoint = host if host
|
102
|
+
config.universe_domain = universe_domain
|
95
103
|
config.lib_name = "gccl"
|
96
104
|
config.lib_version = Google::Cloud::PubSub::VERSION
|
97
105
|
config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}" }
|
@@ -254,7 +262,7 @@ module Google
|
|
254
262
|
# Modifies the PushConfig for a specified subscription.
|
255
263
|
def modify_push_config subscription, endpoint, attributes
|
256
264
|
# Convert attributes to strings to match the protobuf definition
|
257
|
-
attributes =
|
265
|
+
attributes = attributes.to_h { |k, v| [String(k), String(v)] }
|
258
266
|
push_config = Google::Cloud::PubSub::V1::PushConfig.new(
|
259
267
|
push_endpoint: endpoint,
|
260
268
|
attributes: attributes
|
@@ -246,7 +246,7 @@ module Google
|
|
246
246
|
break if synchronize { @stopped }
|
247
247
|
|
248
248
|
begin
|
249
|
-
# Cannot
|
249
|
+
# Cannot synchronize the enumerator, causes deadlock
|
250
250
|
response = enum.next
|
251
251
|
new_exactly_once_delivery_enabled = response&.subscription_properties&.exactly_once_delivery_enabled
|
252
252
|
received_messages = response.received_messages
|
data/lib/google/cloud/pubsub.rb
CHANGED
@@ -62,6 +62,7 @@ module Google
|
|
62
62
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
63
63
|
# @param [String] keyfile Alias for the `credentials` argument.
|
64
64
|
# Deprecated.
|
65
|
+
# @param universe_domain [String] A custom universe domain. Optional.
|
65
66
|
#
|
66
67
|
# @return [Google::Cloud::PubSub::Project]
|
67
68
|
#
|
@@ -77,34 +78,36 @@ module Google
|
|
77
78
|
credentials: nil,
|
78
79
|
scope: nil,
|
79
80
|
timeout: nil,
|
81
|
+
universe_domain: nil,
|
80
82
|
endpoint: nil,
|
81
83
|
emulator_host: nil,
|
82
84
|
project: nil,
|
83
85
|
keyfile: nil
|
84
|
-
project_id
|
85
|
-
scope
|
86
|
-
timeout
|
87
|
-
endpoint
|
86
|
+
project_id ||= project || default_project_id
|
87
|
+
scope ||= configure.scope
|
88
|
+
timeout ||= configure.timeout
|
89
|
+
endpoint ||= configure.endpoint
|
90
|
+
universe_domain ||= configure.universe_domain
|
88
91
|
emulator_host ||= configure.emulator_host
|
89
92
|
|
90
93
|
if emulator_host
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
credentials ||= (keyfile || default_credentials(scope: scope))
|
99
|
-
unless credentials.is_a? Google::Auth::Credentials
|
100
|
-
credentials = PubSub::Credentials.new credentials, scope: scope
|
94
|
+
credentials = :this_channel_is_insecure
|
95
|
+
endpoint = emulator_host
|
96
|
+
else
|
97
|
+
credentials ||= keyfile || default_credentials(scope: scope)
|
98
|
+
unless credentials.is_a? Google::Auth::Credentials
|
99
|
+
credentials = PubSub::Credentials.new credentials, scope: scope
|
100
|
+
end
|
101
101
|
end
|
102
102
|
|
103
103
|
project_id ||= credentials.project_id if credentials.respond_to? :project_id
|
104
104
|
project_id = project_id.to_s # Always cast to a string
|
105
105
|
raise ArgumentError, "project_id is missing" if project_id.empty?
|
106
106
|
|
107
|
-
service = PubSub::Service.new project_id, credentials,
|
107
|
+
service = PubSub::Service.new project_id, credentials,
|
108
|
+
host: endpoint,
|
109
|
+
timeout: timeout,
|
110
|
+
universe_domain: universe_domain
|
108
111
|
PubSub::Project.new service
|
109
112
|
end
|
110
113
|
|
data/lib/google-cloud-pubsub.rb
CHANGED
@@ -110,7 +110,7 @@ module Google
|
|
110
110
|
end
|
111
111
|
|
112
112
|
# Set the default pubsub configuration
|
113
|
-
Google::Cloud.configure.add_config! :pubsub do |config|
|
113
|
+
Google::Cloud.configure.add_config! :pubsub do |config| # rubocop:disable Metrics/BlockLength
|
114
114
|
default_project = Google::Cloud::Config.deferred do
|
115
115
|
ENV["PUBSUB_PROJECT"]
|
116
116
|
end
|
@@ -136,5 +136,6 @@ Google::Cloud.configure.add_config! :pubsub do |config|
|
|
136
136
|
config.add_field! :timeout, nil, match: Numeric
|
137
137
|
config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
|
138
138
|
config.add_field! :on_error, nil, match: Proc
|
139
|
-
config.add_field! :endpoint,
|
139
|
+
config.add_field! :endpoint, nil, match: String
|
140
|
+
config.add_field! :universe_domain, nil, match: String
|
140
141
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-pubsub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '0.
|
48
|
+
version: '0.20'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '0.
|
55
|
+
version: '0.20'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: retriable
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,160 +67,6 @@ dependencies:
|
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '3.1'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: autotest-suffix
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - "~>"
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '1.1'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - "~>"
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '1.1'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: avro
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - "~>"
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '1.10'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - "~>"
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '1.10'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: google-style
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - "~>"
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: 1.25.1
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - "~>"
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: 1.25.1
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: minitest
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - "~>"
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '5.16'
|
119
|
-
type: :development
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - "~>"
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '5.16'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: minitest-autotest
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - "~>"
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: '1.0'
|
133
|
-
type: :development
|
134
|
-
prerelease: false
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - "~>"
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '1.0'
|
140
|
-
- !ruby/object:Gem::Dependency
|
141
|
-
name: minitest-focus
|
142
|
-
requirement: !ruby/object:Gem::Requirement
|
143
|
-
requirements:
|
144
|
-
- - "~>"
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: '1.1'
|
147
|
-
type: :development
|
148
|
-
prerelease: false
|
149
|
-
version_requirements: !ruby/object:Gem::Requirement
|
150
|
-
requirements:
|
151
|
-
- - "~>"
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: '1.1'
|
154
|
-
- !ruby/object:Gem::Dependency
|
155
|
-
name: minitest-rg
|
156
|
-
requirement: !ruby/object:Gem::Requirement
|
157
|
-
requirements:
|
158
|
-
- - "~>"
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version: '5.2'
|
161
|
-
type: :development
|
162
|
-
prerelease: false
|
163
|
-
version_requirements: !ruby/object:Gem::Requirement
|
164
|
-
requirements:
|
165
|
-
- - "~>"
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version: '5.2'
|
168
|
-
- !ruby/object:Gem::Dependency
|
169
|
-
name: redcarpet
|
170
|
-
requirement: !ruby/object:Gem::Requirement
|
171
|
-
requirements:
|
172
|
-
- - "~>"
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: '3.0'
|
175
|
-
type: :development
|
176
|
-
prerelease: false
|
177
|
-
version_requirements: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - "~>"
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '3.0'
|
182
|
-
- !ruby/object:Gem::Dependency
|
183
|
-
name: simplecov
|
184
|
-
requirement: !ruby/object:Gem::Requirement
|
185
|
-
requirements:
|
186
|
-
- - "~>"
|
187
|
-
- !ruby/object:Gem::Version
|
188
|
-
version: '0.9'
|
189
|
-
type: :development
|
190
|
-
prerelease: false
|
191
|
-
version_requirements: !ruby/object:Gem::Requirement
|
192
|
-
requirements:
|
193
|
-
- - "~>"
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: '0.9'
|
196
|
-
- !ruby/object:Gem::Dependency
|
197
|
-
name: yard
|
198
|
-
requirement: !ruby/object:Gem::Requirement
|
199
|
-
requirements:
|
200
|
-
- - "~>"
|
201
|
-
- !ruby/object:Gem::Version
|
202
|
-
version: '0.9'
|
203
|
-
type: :development
|
204
|
-
prerelease: false
|
205
|
-
version_requirements: !ruby/object:Gem::Requirement
|
206
|
-
requirements:
|
207
|
-
- - "~>"
|
208
|
-
- !ruby/object:Gem::Version
|
209
|
-
version: '0.9'
|
210
|
-
- !ruby/object:Gem::Dependency
|
211
|
-
name: yard-doctest
|
212
|
-
requirement: !ruby/object:Gem::Requirement
|
213
|
-
requirements:
|
214
|
-
- - "~>"
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
version: 0.1.13
|
217
|
-
type: :development
|
218
|
-
prerelease: false
|
219
|
-
version_requirements: !ruby/object:Gem::Requirement
|
220
|
-
requirements:
|
221
|
-
- - "~>"
|
222
|
-
- !ruby/object:Gem::Version
|
223
|
-
version: 0.1.13
|
224
70
|
description: google-cloud-pubsub is the official library for Google Cloud Pub/Sub.
|
225
71
|
email:
|
226
72
|
- mike@blowmage.com
|
@@ -284,14 +130,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
284
130
|
requirements:
|
285
131
|
- - ">="
|
286
132
|
- !ruby/object:Gem::Version
|
287
|
-
version: '2.
|
133
|
+
version: '2.7'
|
288
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
289
135
|
requirements:
|
290
136
|
- - ">="
|
291
137
|
- !ruby/object:Gem::Version
|
292
138
|
version: '0'
|
293
139
|
requirements: []
|
294
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.5.6
|
295
141
|
signing_key:
|
296
142
|
specification_version: 4
|
297
143
|
summary: API Client library for Google Cloud Pub/Sub
|