google-cloud-pubsub 0.33.2 → 0.34.0
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 +4 -4
- data/AUTHENTICATION.md +4 -4
- data/CHANGELOG.md +45 -0
- data/EMULATOR.md +2 -2
- data/OVERVIEW.md +81 -43
- data/lib/google-cloud-pubsub.rb +10 -7
- data/lib/google/cloud/pubsub.rb +38 -21
- data/lib/google/cloud/pubsub/async_publisher.rb +8 -6
- data/lib/google/cloud/pubsub/batch_publisher.rb +7 -5
- data/lib/google/cloud/pubsub/convert.rb +5 -3
- data/lib/google/cloud/pubsub/credentials.rb +6 -4
- data/lib/google/cloud/pubsub/message.rb +9 -6
- data/lib/google/cloud/pubsub/policy.rb +12 -10
- data/lib/google/cloud/pubsub/project.rb +30 -28
- data/lib/google/cloud/pubsub/publish_result.rb +3 -1
- data/lib/google/cloud/pubsub/received_message.rb +11 -10
- data/lib/google/cloud/pubsub/service.rb +47 -37
- data/lib/google/cloud/pubsub/snapshot.rb +11 -9
- data/lib/google/cloud/pubsub/snapshot/list.rb +10 -8
- data/lib/google/cloud/pubsub/subscriber.rb +32 -6
- data/lib/google/cloud/pubsub/subscriber/enumerator_queue.rb +3 -1
- data/lib/google/cloud/pubsub/subscriber/inventory.rb +4 -2
- data/lib/google/cloud/pubsub/subscriber/stream.rb +23 -43
- data/lib/google/cloud/pubsub/subscriber/timed_unary_buffer.rb +221 -0
- data/lib/google/cloud/pubsub/subscription.rb +157 -80
- data/lib/google/cloud/pubsub/subscription/list.rb +12 -10
- data/lib/google/cloud/pubsub/topic.rb +79 -51
- data/lib/google/cloud/pubsub/topic/list.rb +10 -8
- data/lib/google/cloud/pubsub/v1/credentials.rb +4 -2
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +1 -43
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +1 -108
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +1 -1
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +1 -1
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +1 -1
- data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +107 -61
- data/lib/google/cloud/pubsub/v1/publisher_client.rb +58 -55
- data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -4
- data/lib/google/cloud/pubsub/v1/subscriber_client.rb +177 -128
- data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -4
- data/lib/google/cloud/pubsub/version.rb +4 -2
- data/lib/google/pubsub/v1/pubsub_pb.rb +48 -40
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +201 -161
- metadata +6 -7
- data/lib/google/cloud/pubsub/subscriber/async_stream_pusher.rb +0 -223
- data/lib/google/cloud/pubsub/subscriber/async_unary_pusher.rb +0 -271
|
@@ -22,7 +22,7 @@ require "google/cloud/pubsub/snapshot"
|
|
|
22
22
|
|
|
23
23
|
module Google
|
|
24
24
|
module Cloud
|
|
25
|
-
module
|
|
25
|
+
module PubSub
|
|
26
26
|
##
|
|
27
27
|
# # Project
|
|
28
28
|
#
|
|
@@ -39,7 +39,7 @@ module Google
|
|
|
39
39
|
# @example
|
|
40
40
|
# require "google/cloud/pubsub"
|
|
41
41
|
#
|
|
42
|
-
# pubsub = Google::Cloud::
|
|
42
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
43
43
|
#
|
|
44
44
|
# topic = pubsub.topic "my-topic"
|
|
45
45
|
# topic.publish "task completed"
|
|
@@ -60,7 +60,7 @@ module Google
|
|
|
60
60
|
# @example
|
|
61
61
|
# require "google/cloud/pubsub"
|
|
62
62
|
#
|
|
63
|
-
# pubsub = Google::Cloud::
|
|
63
|
+
# pubsub = Google::Cloud::PubSub.new(
|
|
64
64
|
# project_id: "my-project",
|
|
65
65
|
# credentials: "/path/to/keyfile.json"
|
|
66
66
|
# )
|
|
@@ -103,37 +103,37 @@ module Google
|
|
|
103
103
|
# * `:callback` (Integer) The number of threads to handle the
|
|
104
104
|
# published messages' callbacks. Default is 8.
|
|
105
105
|
#
|
|
106
|
-
# @return [Google::Cloud::
|
|
106
|
+
# @return [Google::Cloud::PubSub::Topic, nil] Returns `nil` if topic
|
|
107
107
|
# does not exist.
|
|
108
108
|
#
|
|
109
109
|
# @example
|
|
110
110
|
# require "google/cloud/pubsub"
|
|
111
111
|
#
|
|
112
|
-
# pubsub = Google::Cloud::
|
|
112
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
113
113
|
# topic = pubsub.topic "existing-topic"
|
|
114
114
|
#
|
|
115
115
|
# @example By default `nil` will be returned if topic does not exist.
|
|
116
116
|
# require "google/cloud/pubsub"
|
|
117
117
|
#
|
|
118
|
-
# pubsub = Google::Cloud::
|
|
118
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
119
119
|
# topic = pubsub.topic "non-existing-topic" # nil
|
|
120
120
|
#
|
|
121
121
|
# @example Create topic in a different project with the `project` flag.
|
|
122
122
|
# require "google/cloud/pubsub"
|
|
123
123
|
#
|
|
124
|
-
# pubsub = Google::Cloud::
|
|
124
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
125
125
|
# topic = pubsub.topic "another-topic", project: "another-project"
|
|
126
126
|
#
|
|
127
127
|
# @example Skip the lookup against the service with `skip_lookup`:
|
|
128
128
|
# require "google/cloud/pubsub"
|
|
129
129
|
#
|
|
130
|
-
# pubsub = Google::Cloud::
|
|
130
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
131
131
|
# topic = pubsub.topic "another-topic", skip_lookup: true
|
|
132
132
|
#
|
|
133
133
|
# @example Configuring AsyncPublisher to increase concurrent callbacks:
|
|
134
134
|
# require "google/cloud/pubsub"
|
|
135
135
|
#
|
|
136
|
-
# pubsub = Google::Cloud::
|
|
136
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
137
137
|
# topic = pubsub.topic "my-topic",
|
|
138
138
|
# async: { threads: { callback: 16 } }
|
|
139
139
|
#
|
|
@@ -150,7 +150,7 @@ module Google
|
|
|
150
150
|
def topic topic_name, project: nil, skip_lookup: nil, async: nil
|
|
151
151
|
ensure_service!
|
|
152
152
|
options = { project: project }
|
|
153
|
-
return Topic.
|
|
153
|
+
return Topic.from_name(topic_name, service, options) if skip_lookup
|
|
154
154
|
grpc = service.get_topic topic_name
|
|
155
155
|
Topic.from_grpc grpc, service, async: async
|
|
156
156
|
rescue Google::Cloud::NotFoundError
|
|
@@ -191,12 +191,12 @@ module Google
|
|
|
191
191
|
# * `:callback` (Integer) The number of threads to handle the
|
|
192
192
|
# published messages' callbacks. Default is 8.
|
|
193
193
|
#
|
|
194
|
-
# @return [Google::Cloud::
|
|
194
|
+
# @return [Google::Cloud::PubSub::Topic]
|
|
195
195
|
#
|
|
196
196
|
# @example
|
|
197
197
|
# require "google/cloud/pubsub"
|
|
198
198
|
#
|
|
199
|
-
# pubsub = Google::Cloud::
|
|
199
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
200
200
|
# topic = pubsub.create_topic "my-topic"
|
|
201
201
|
#
|
|
202
202
|
def create_topic topic_name, labels: nil, async: nil
|
|
@@ -214,13 +214,13 @@ module Google
|
|
|
214
214
|
# the system should return the next page of data.
|
|
215
215
|
# @param [Integer] max Maximum number of topics to return.
|
|
216
216
|
#
|
|
217
|
-
# @return [Array<Google::Cloud::
|
|
218
|
-
# {Google::Cloud::
|
|
217
|
+
# @return [Array<Google::Cloud::PubSub::Topic>] (See
|
|
218
|
+
# {Google::Cloud::PubSub::Topic::List})
|
|
219
219
|
#
|
|
220
220
|
# @example
|
|
221
221
|
# require "google/cloud/pubsub"
|
|
222
222
|
#
|
|
223
|
-
# pubsub = Google::Cloud::
|
|
223
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
224
224
|
#
|
|
225
225
|
# topics = pubsub.topics
|
|
226
226
|
# topics.each do |topic|
|
|
@@ -230,7 +230,7 @@ module Google
|
|
|
230
230
|
# @example Retrieve all topics: (See {Topic::List#all})
|
|
231
231
|
# require "google/cloud/pubsub"
|
|
232
232
|
#
|
|
233
|
-
# pubsub = Google::Cloud::
|
|
233
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
234
234
|
#
|
|
235
235
|
# topics = pubsub.topics
|
|
236
236
|
# topics.all do |topic|
|
|
@@ -258,13 +258,13 @@ module Google
|
|
|
258
258
|
# service. Calls made on this object will raise errors if the service
|
|
259
259
|
# resource does not exist. Default is `false`.
|
|
260
260
|
#
|
|
261
|
-
# @return [Google::Cloud::
|
|
261
|
+
# @return [Google::Cloud::PubSub::Subscription, nil] Returns `nil` if
|
|
262
262
|
# the subscription does not exist
|
|
263
263
|
#
|
|
264
264
|
# @example
|
|
265
265
|
# require "google/cloud/pubsub"
|
|
266
266
|
#
|
|
267
|
-
# pubsub = Google::Cloud::
|
|
267
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
268
268
|
#
|
|
269
269
|
# sub = pubsub.subscription "my-sub"
|
|
270
270
|
# sub.name #=> "projects/my-project/subscriptions/my-sub"
|
|
@@ -272,7 +272,7 @@ module Google
|
|
|
272
272
|
# @example Skip the lookup against the service with `skip_lookup`:
|
|
273
273
|
# require "google/cloud/pubsub"
|
|
274
274
|
#
|
|
275
|
-
# pubsub = Google::Cloud::
|
|
275
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
276
276
|
#
|
|
277
277
|
# # No API call is made to retrieve the subscription information.
|
|
278
278
|
# sub = pubsub.subscription "my-sub", skip_lookup: true
|
|
@@ -282,7 +282,7 @@ module Google
|
|
|
282
282
|
ensure_service!
|
|
283
283
|
options = { project: project }
|
|
284
284
|
if skip_lookup
|
|
285
|
-
return Subscription.
|
|
285
|
+
return Subscription.from_name subscription_name, service, options
|
|
286
286
|
end
|
|
287
287
|
grpc = service.get_subscription subscription_name
|
|
288
288
|
Subscription.from_grpc grpc, service
|
|
@@ -299,13 +299,13 @@ module Google
|
|
|
299
299
|
# part of the larger set of results to view.
|
|
300
300
|
# @param [Integer] max Maximum number of subscriptions to return.
|
|
301
301
|
#
|
|
302
|
-
# @return [Array<Google::Cloud::
|
|
303
|
-
# {Google::Cloud::
|
|
302
|
+
# @return [Array<Google::Cloud::PubSub::Subscription>] (See
|
|
303
|
+
# {Google::Cloud::PubSub::Subscription::List})
|
|
304
304
|
#
|
|
305
305
|
# @example
|
|
306
306
|
# require "google/cloud/pubsub"
|
|
307
307
|
#
|
|
308
|
-
# pubsub = Google::Cloud::
|
|
308
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
309
309
|
#
|
|
310
310
|
# subs = pubsub.subscriptions
|
|
311
311
|
# subs.each do |sub|
|
|
@@ -315,7 +315,7 @@ module Google
|
|
|
315
315
|
# @example Retrieve all subscriptions: (See {Subscription::List#all})
|
|
316
316
|
# require "google/cloud/pubsub"
|
|
317
317
|
#
|
|
318
|
-
# pubsub = Google::Cloud::
|
|
318
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
319
319
|
#
|
|
320
320
|
# subs = pubsub.subscriptions
|
|
321
321
|
# subs.all do |sub|
|
|
@@ -339,13 +339,13 @@ module Google
|
|
|
339
339
|
# part of the larger set of results to view.
|
|
340
340
|
# @param [Integer] max Maximum number of snapshots to return.
|
|
341
341
|
#
|
|
342
|
-
# @return [Array<Google::Cloud::
|
|
343
|
-
# {Google::Cloud::
|
|
342
|
+
# @return [Array<Google::Cloud::PubSub::Snapshot>] (See
|
|
343
|
+
# {Google::Cloud::PubSub::Snapshot::List})
|
|
344
344
|
#
|
|
345
345
|
# @example
|
|
346
346
|
# require "google/cloud/pubsub"
|
|
347
347
|
#
|
|
348
|
-
# pubsub = Google::Cloud::
|
|
348
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
349
349
|
#
|
|
350
350
|
# snapshots = pubsub.snapshots
|
|
351
351
|
# snapshots.each do |snapshot|
|
|
@@ -355,7 +355,7 @@ module Google
|
|
|
355
355
|
# @example Retrieve all snapshots: (See {Snapshot::List#all})
|
|
356
356
|
# require "google/cloud/pubsub"
|
|
357
357
|
#
|
|
358
|
-
# pubsub = Google::Cloud::
|
|
358
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
359
359
|
#
|
|
360
360
|
# snapshots = pubsub.snapshots
|
|
361
361
|
# snapshots.all do |snapshot|
|
|
@@ -388,5 +388,7 @@ module Google
|
|
|
388
388
|
end
|
|
389
389
|
end
|
|
390
390
|
end
|
|
391
|
+
|
|
392
|
+
Pubsub = PubSub unless const_defined? :Pubsub
|
|
391
393
|
end
|
|
392
394
|
end
|
|
@@ -18,7 +18,7 @@ require "google/cloud/pubsub/message"
|
|
|
18
18
|
|
|
19
19
|
module Google
|
|
20
20
|
module Cloud
|
|
21
|
-
module
|
|
21
|
+
module PubSub
|
|
22
22
|
##
|
|
23
23
|
# # ReceivedMessage
|
|
24
24
|
#
|
|
@@ -27,7 +27,7 @@ module Google
|
|
|
27
27
|
# @example
|
|
28
28
|
# require "google/cloud/pubsub"
|
|
29
29
|
#
|
|
30
|
-
# pubsub = Google::Cloud::
|
|
30
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
31
31
|
#
|
|
32
32
|
# sub = pubsub.subscription "my-topic-sub"
|
|
33
33
|
# subscriber = sub.listen do |received_message|
|
|
@@ -47,14 +47,14 @@ module Google
|
|
|
47
47
|
attr_accessor :subscription
|
|
48
48
|
|
|
49
49
|
##
|
|
50
|
-
# @private The gRPC Google::
|
|
50
|
+
# @private The gRPC Google::Cloud::PubSub::V1::ReceivedMessage object.
|
|
51
51
|
attr_accessor :grpc
|
|
52
52
|
|
|
53
53
|
##
|
|
54
54
|
# @private Create an empty {Subscription} object.
|
|
55
55
|
def initialize
|
|
56
56
|
@subscription = nil
|
|
57
|
-
@grpc = Google::
|
|
57
|
+
@grpc = Google::Cloud::PubSub::V1::ReceivedMessage.new
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
##
|
|
@@ -104,7 +104,7 @@ module Google
|
|
|
104
104
|
# @example
|
|
105
105
|
# require "google/cloud/pubsub"
|
|
106
106
|
#
|
|
107
|
-
# pubsub = Google::Cloud::
|
|
107
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
108
108
|
#
|
|
109
109
|
# sub = pubsub.subscription "my-topic-sub"
|
|
110
110
|
# subscriber = sub.listen do |received_message|
|
|
@@ -140,7 +140,7 @@ module Google
|
|
|
140
140
|
# @example
|
|
141
141
|
# require "google/cloud/pubsub"
|
|
142
142
|
#
|
|
143
|
-
# pubsub = Google::Cloud::
|
|
143
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
144
144
|
#
|
|
145
145
|
# sub = pubsub.subscription "my-topic-sub"
|
|
146
146
|
# subscriber = sub.listen do |received_message|
|
|
@@ -160,7 +160,6 @@ module Google
|
|
|
160
160
|
ensure_subscription!
|
|
161
161
|
subscription.modify_ack_deadline new_deadline, ack_id
|
|
162
162
|
end
|
|
163
|
-
alias delay! modify_ack_deadline!
|
|
164
163
|
|
|
165
164
|
##
|
|
166
165
|
# Resets the acknowledge deadline for the message without acknowledging
|
|
@@ -171,7 +170,7 @@ module Google
|
|
|
171
170
|
# @example
|
|
172
171
|
# require "google/cloud/pubsub"
|
|
173
172
|
#
|
|
174
|
-
# pubsub = Google::Cloud::
|
|
173
|
+
# pubsub = Google::Cloud::PubSub.new
|
|
175
174
|
#
|
|
176
175
|
# sub = pubsub.subscription "my-topic-sub"
|
|
177
176
|
# subscriber = sub.listen do |received_message|
|
|
@@ -188,14 +187,14 @@ module Google
|
|
|
188
187
|
# subscriber.stop.wait!
|
|
189
188
|
#
|
|
190
189
|
def reject!
|
|
191
|
-
|
|
190
|
+
modify_ack_deadline! 0
|
|
192
191
|
end
|
|
193
192
|
alias nack! reject!
|
|
194
193
|
alias ignore! reject!
|
|
195
194
|
|
|
196
195
|
##
|
|
197
196
|
# @private New ReceivedMessage from a
|
|
198
|
-
# Google::
|
|
197
|
+
# Google::Cloud::PubSub::V1::ReceivedMessage object.
|
|
199
198
|
def self.from_grpc grpc, subscription
|
|
200
199
|
new.tap do |rm|
|
|
201
200
|
rm.grpc = grpc
|
|
@@ -212,5 +211,7 @@ module Google
|
|
|
212
211
|
end
|
|
213
212
|
end
|
|
214
213
|
end
|
|
214
|
+
|
|
215
|
+
Pubsub = PubSub unless const_defined? :Pubsub
|
|
215
216
|
end
|
|
216
217
|
end
|
|
@@ -22,7 +22,7 @@ require "google/gax/errors"
|
|
|
22
22
|
|
|
23
23
|
module Google
|
|
24
24
|
module Cloud
|
|
25
|
-
module
|
|
25
|
+
module PubSub
|
|
26
26
|
##
|
|
27
27
|
# @private Represents the GAX Pub/Sub service, including all the API
|
|
28
28
|
# methods.
|
|
@@ -62,11 +62,11 @@ module Google
|
|
|
62
62
|
return mocked_subscriber if mocked_subscriber
|
|
63
63
|
@subscriber ||= begin
|
|
64
64
|
V1::SubscriberClient.new(
|
|
65
|
-
credentials:
|
|
66
|
-
timeout:
|
|
65
|
+
credentials: channel,
|
|
66
|
+
timeout: timeout,
|
|
67
67
|
client_config: client_config,
|
|
68
|
-
lib_name:
|
|
69
|
-
lib_version:
|
|
68
|
+
lib_name: "gccl",
|
|
69
|
+
lib_version: Google::Cloud::PubSub::VERSION
|
|
70
70
|
)
|
|
71
71
|
end
|
|
72
72
|
end
|
|
@@ -76,11 +76,11 @@ module Google
|
|
|
76
76
|
return mocked_publisher if mocked_publisher
|
|
77
77
|
@publisher ||= begin
|
|
78
78
|
V1::PublisherClient.new(
|
|
79
|
-
credentials:
|
|
80
|
-
timeout:
|
|
79
|
+
credentials: channel,
|
|
80
|
+
timeout: timeout,
|
|
81
81
|
client_config: client_config,
|
|
82
|
-
lib_name:
|
|
83
|
-
lib_version:
|
|
82
|
+
lib_name: "gccl",
|
|
83
|
+
lib_version: Google::Cloud::PubSub::VERSION
|
|
84
84
|
)
|
|
85
85
|
end
|
|
86
86
|
end
|
|
@@ -108,14 +108,16 @@ module Google
|
|
|
108
108
|
def list_topics options = {}
|
|
109
109
|
call_options = default_options
|
|
110
110
|
if (token = options[:token])
|
|
111
|
-
call_options = Google::Gax::CallOptions.new
|
|
112
|
-
|
|
111
|
+
call_options = Google::Gax::CallOptions.new(
|
|
112
|
+
kwargs: default_headers,
|
|
113
|
+
page_token: token
|
|
114
|
+
)
|
|
113
115
|
end
|
|
114
116
|
|
|
115
117
|
execute do
|
|
116
118
|
paged_enum = publisher.list_topics project_path(options),
|
|
117
119
|
page_size: options[:max],
|
|
118
|
-
options:
|
|
120
|
+
options: call_options
|
|
119
121
|
|
|
120
122
|
paged_enum.page.response
|
|
121
123
|
end
|
|
@@ -126,7 +128,7 @@ module Google
|
|
|
126
128
|
def create_topic topic_name, labels: nil, options: {}
|
|
127
129
|
execute do
|
|
128
130
|
publisher.create_topic topic_path(topic_name, options),
|
|
129
|
-
labels:
|
|
131
|
+
labels: labels,
|
|
130
132
|
options: default_options
|
|
131
133
|
end
|
|
132
134
|
end
|
|
@@ -177,15 +179,17 @@ module Google
|
|
|
177
179
|
def list_topics_subscriptions topic, options = {}
|
|
178
180
|
call_options = default_options
|
|
179
181
|
if (token = options[:token])
|
|
180
|
-
call_options = Google::Gax::CallOptions.new
|
|
181
|
-
|
|
182
|
+
call_options = Google::Gax::CallOptions.new(
|
|
183
|
+
kwargs: default_headers,
|
|
184
|
+
page_token: token
|
|
185
|
+
)
|
|
182
186
|
end
|
|
183
187
|
|
|
184
188
|
execute do
|
|
185
189
|
paged_enum = publisher.list_topic_subscriptions \
|
|
186
190
|
topic_path(topic, options),
|
|
187
191
|
page_size: options[:max],
|
|
188
|
-
options:
|
|
192
|
+
options: call_options
|
|
189
193
|
|
|
190
194
|
paged_enum.page.response
|
|
191
195
|
end
|
|
@@ -196,14 +200,16 @@ module Google
|
|
|
196
200
|
def list_subscriptions options = {}
|
|
197
201
|
call_options = default_options
|
|
198
202
|
if (token = options[:token])
|
|
199
|
-
call_options = Google::Gax::CallOptions.new
|
|
200
|
-
|
|
203
|
+
call_options = Google::Gax::CallOptions.new(
|
|
204
|
+
kwargs: default_headers,
|
|
205
|
+
page_token: token
|
|
206
|
+
)
|
|
201
207
|
end
|
|
202
208
|
|
|
203
209
|
execute do
|
|
204
210
|
paged_enum = subscriber.list_subscriptions project_path(options),
|
|
205
211
|
page_size: options[:max],
|
|
206
|
-
options:
|
|
212
|
+
options: call_options
|
|
207
213
|
|
|
208
214
|
paged_enum.page.response
|
|
209
215
|
end
|
|
@@ -215,9 +221,9 @@ module Google
|
|
|
215
221
|
name = subscription_path(subscription_name, options)
|
|
216
222
|
topic = topic_path(topic)
|
|
217
223
|
push_config = if options[:endpoint]
|
|
218
|
-
Google::
|
|
224
|
+
Google::Cloud::PubSub::V1::PushConfig.new \
|
|
219
225
|
push_endpoint: options[:endpoint],
|
|
220
|
-
attributes:
|
|
226
|
+
attributes: (options[:attributes] || {}).to_h
|
|
221
227
|
end
|
|
222
228
|
deadline = options[:deadline]
|
|
223
229
|
retain_acked = options[:retain_acked]
|
|
@@ -225,14 +231,14 @@ module Google
|
|
|
225
231
|
labels = options[:labels]
|
|
226
232
|
|
|
227
233
|
execute do
|
|
228
|
-
subscriber.create_subscription
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
subscriber.create_subscription \
|
|
235
|
+
name, topic,
|
|
236
|
+
push_config: push_config,
|
|
237
|
+
ack_deadline_seconds: deadline,
|
|
238
|
+
retain_acked_messages: retain_acked,
|
|
239
|
+
message_retention_duration: mrd,
|
|
240
|
+
labels: labels,
|
|
241
|
+
options: default_options
|
|
236
242
|
end
|
|
237
243
|
end
|
|
238
244
|
|
|
@@ -265,7 +271,7 @@ module Google
|
|
|
265
271
|
subscriber.pull subscription,
|
|
266
272
|
max_messages,
|
|
267
273
|
return_immediately: return_immediately,
|
|
268
|
-
options:
|
|
274
|
+
options: default_options
|
|
269
275
|
end
|
|
270
276
|
end
|
|
271
277
|
|
|
@@ -290,9 +296,9 @@ module Google
|
|
|
290
296
|
subscription = subscription_path(subscription)
|
|
291
297
|
# Convert attributes to strings to match the protobuf definition
|
|
292
298
|
attributes = Hash[attributes.map { |k, v| [String(k), String(v)] }]
|
|
293
|
-
push_config = Google::
|
|
299
|
+
push_config = Google::Cloud::PubSub::V1::PushConfig.new(
|
|
294
300
|
push_endpoint: endpoint,
|
|
295
|
-
attributes:
|
|
301
|
+
attributes: attributes
|
|
296
302
|
)
|
|
297
303
|
|
|
298
304
|
execute do
|
|
@@ -316,14 +322,16 @@ module Google
|
|
|
316
322
|
def list_snapshots options = {}
|
|
317
323
|
call_options = default_options
|
|
318
324
|
if (token = options[:token])
|
|
319
|
-
call_options = Google::Gax::CallOptions.new
|
|
320
|
-
|
|
325
|
+
call_options = Google::Gax::CallOptions.new(
|
|
326
|
+
kwargs: default_headers,
|
|
327
|
+
page_token: token
|
|
328
|
+
)
|
|
321
329
|
end
|
|
322
330
|
|
|
323
331
|
execute do
|
|
324
332
|
paged_enum = subscriber.list_snapshots project_path(options),
|
|
325
333
|
page_size: options[:max],
|
|
326
|
-
options:
|
|
334
|
+
options: call_options
|
|
327
335
|
|
|
328
336
|
paged_enum.page.response
|
|
329
337
|
end
|
|
@@ -336,7 +344,7 @@ module Google
|
|
|
336
344
|
execute do
|
|
337
345
|
subscriber.create_snapshot name,
|
|
338
346
|
subscription_path(subscription),
|
|
339
|
-
labels:
|
|
347
|
+
labels: labels,
|
|
340
348
|
options: default_options
|
|
341
349
|
end
|
|
342
350
|
end
|
|
@@ -373,7 +381,7 @@ module Google
|
|
|
373
381
|
end
|
|
374
382
|
subscriber.seek subscription,
|
|
375
383
|
snapshot: snapshot_path(time_or_snapshot),
|
|
376
|
-
options:
|
|
384
|
+
options: default_options
|
|
377
385
|
end
|
|
378
386
|
end
|
|
379
387
|
end
|
|
@@ -481,5 +489,7 @@ module Google
|
|
|
481
489
|
end
|
|
482
490
|
end
|
|
483
491
|
end
|
|
492
|
+
|
|
493
|
+
Pubsub = PubSub unless const_defined? :Pubsub
|
|
484
494
|
end
|
|
485
495
|
end
|