google-cloud-pubsub 0.26.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.yardopts +12 -2
- data/AUTHENTICATION.md +178 -0
- data/CHANGELOG.md +659 -0
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +187 -0
- data/EMULATOR.md +37 -0
- data/LICENSE +2 -2
- data/LOGGING.md +32 -0
- data/OVERVIEW.md +528 -0
- data/TROUBLESHOOTING.md +31 -0
- data/lib/google/cloud/pubsub/async_publisher/batch.rb +310 -0
- data/lib/google/cloud/pubsub/async_publisher.rb +402 -0
- data/lib/google/cloud/pubsub/batch_publisher.rb +100 -0
- data/lib/google/cloud/pubsub/convert.rb +91 -0
- data/lib/google/cloud/pubsub/credentials.rb +26 -10
- data/lib/google/cloud/pubsub/errors.rb +85 -0
- data/lib/google/cloud/pubsub/message.rb +80 -17
- data/lib/google/cloud/pubsub/policy.rb +17 -14
- data/lib/google/cloud/pubsub/project.rb +364 -250
- data/lib/google/cloud/pubsub/publish_result.rb +103 -0
- data/lib/google/cloud/pubsub/received_message.rb +162 -24
- data/lib/google/cloud/pubsub/retry_policy.rb +88 -0
- data/lib/google/cloud/pubsub/schema/list.rb +180 -0
- data/lib/google/cloud/pubsub/schema.rb +310 -0
- data/lib/google/cloud/pubsub/service.rb +281 -265
- data/lib/google/cloud/pubsub/snapshot/list.rb +21 -21
- data/lib/google/cloud/pubsub/snapshot.rb +55 -15
- data/lib/google/cloud/pubsub/subscriber/enumerator_queue.rb +54 -0
- data/lib/google/cloud/pubsub/subscriber/inventory.rb +173 -0
- data/lib/google/cloud/pubsub/subscriber/sequencer.rb +115 -0
- data/lib/google/cloud/pubsub/subscriber/stream.rb +400 -0
- data/lib/google/cloud/pubsub/subscriber/timed_unary_buffer.rb +230 -0
- data/lib/google/cloud/pubsub/subscriber.rb +417 -0
- data/lib/google/cloud/pubsub/subscription/list.rb +28 -28
- data/lib/google/cloud/pubsub/subscription/push_config.rb +268 -0
- data/lib/google/cloud/pubsub/subscription.rb +900 -172
- data/lib/google/cloud/pubsub/topic/list.rb +21 -21
- data/lib/google/cloud/pubsub/topic.rb +674 -95
- data/lib/google/cloud/pubsub/version.rb +6 -4
- data/lib/google/cloud/pubsub.rb +104 -439
- data/lib/google-cloud-pubsub.rb +60 -29
- metadata +88 -50
- data/README.md +0 -69
- data/lib/google/cloud/pubsub/topic/publisher.rb +0 -86
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +0 -77
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +0 -223
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +0 -81
- data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +0 -503
- data/lib/google/cloud/pubsub/v1/publisher_client.rb +0 -605
- data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -96
- data/lib/google/cloud/pubsub/v1/subscriber_client.rb +0 -1104
- data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -127
- data/lib/google/cloud/pubsub/v1.rb +0 -17
- data/lib/google/pubsub/v1/pubsub_pb.rb +0 -187
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +0 -159
@@ -0,0 +1,103 @@
|
|
1
|
+
# Copyright 2017 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
module Google
|
17
|
+
module Cloud
|
18
|
+
module PubSub
|
19
|
+
##
|
20
|
+
# The result of a publish operation. The message object is available on
|
21
|
+
# {#message} and will have {#message_id} assigned by the API.
|
22
|
+
#
|
23
|
+
# When the publish operation was successful the result will be marked
|
24
|
+
# {#succeeded?}. Otherwise, the result will be marked {#failed?} and the
|
25
|
+
# error raised will be availabe on {#error}.
|
26
|
+
#
|
27
|
+
class PublishResult
|
28
|
+
##
|
29
|
+
# @private Create an PublishResult object.
|
30
|
+
def initialize message, error = nil
|
31
|
+
@message = message
|
32
|
+
@error = error
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# The message.
|
37
|
+
def message
|
38
|
+
@message
|
39
|
+
end
|
40
|
+
alias msg message
|
41
|
+
|
42
|
+
##
|
43
|
+
# The message's data.
|
44
|
+
def data
|
45
|
+
message.data
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# The message's attributes.
|
50
|
+
def attributes
|
51
|
+
message.attributes
|
52
|
+
end
|
53
|
+
|
54
|
+
##
|
55
|
+
# The ID of the message, assigned by the server at publication
|
56
|
+
# time. Guaranteed to be unique within the topic.
|
57
|
+
def message_id
|
58
|
+
message.message_id
|
59
|
+
end
|
60
|
+
alias msg_id message_id
|
61
|
+
|
62
|
+
##
|
63
|
+
# The time at which the message was published.
|
64
|
+
def published_at
|
65
|
+
message.published_at
|
66
|
+
end
|
67
|
+
alias publish_time published_at
|
68
|
+
|
69
|
+
##
|
70
|
+
# The error that was raised when published, if any.
|
71
|
+
def error
|
72
|
+
@error
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Whether the publish request was successful.
|
77
|
+
def succeeded?
|
78
|
+
error.nil?
|
79
|
+
end
|
80
|
+
|
81
|
+
# Whether the publish request failed.
|
82
|
+
def failed?
|
83
|
+
!succeeded?
|
84
|
+
end
|
85
|
+
|
86
|
+
##
|
87
|
+
# @private Create an PublishResult object from a message protobuf.
|
88
|
+
def self.from_grpc msg_grpc
|
89
|
+
new Message.from_grpc(msg_grpc)
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# @private Create an PublishResult object from a message protobuf and an
|
94
|
+
# error.
|
95
|
+
def self.from_error msg_grpc, error
|
96
|
+
new Message.from_grpc(msg_grpc), error
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
Pubsub = PubSub unless const_defined? :Pubsub
|
102
|
+
end
|
103
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# Copyright 2015 Google
|
1
|
+
# Copyright 2015 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
8
|
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -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,29 +27,34 @@ 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
|
-
#
|
34
|
-
# if received_message
|
33
|
+
# subscriber = sub.listen do |received_message|
|
35
34
|
# puts received_message.message.data
|
36
35
|
# received_message.acknowledge!
|
37
36
|
# end
|
38
37
|
#
|
38
|
+
# # Start background threads that will call the block passed to listen.
|
39
|
+
# subscriber.start
|
40
|
+
#
|
41
|
+
# # Shut down the subscriber when ready to stop receiving messages.
|
42
|
+
# subscriber.stop!
|
43
|
+
#
|
39
44
|
class ReceivedMessage
|
40
45
|
##
|
41
46
|
# @private The {Subscription} object.
|
42
47
|
attr_accessor :subscription
|
43
48
|
|
44
49
|
##
|
45
|
-
# @private The gRPC Google::
|
50
|
+
# @private The gRPC Google::Cloud::PubSub::V1::ReceivedMessage object.
|
46
51
|
attr_accessor :grpc
|
47
52
|
|
48
53
|
##
|
49
54
|
# @private Create an empty {Subscription} object.
|
50
55
|
def initialize
|
51
56
|
@subscription = nil
|
52
|
-
@grpc = Google::
|
57
|
+
@grpc = Google::Cloud::PubSub::V1::ReceivedMessage.new
|
53
58
|
end
|
54
59
|
|
55
60
|
##
|
@@ -58,21 +63,60 @@ module Google
|
|
58
63
|
@grpc.ack_id
|
59
64
|
end
|
60
65
|
|
66
|
+
##
|
67
|
+
# Returns the delivery attempt counter for the message. If a dead letter policy is not set on the subscription,
|
68
|
+
# this will be `nil`. See {Topic#subscribe}, {Subscription#dead_letter_topic=} and
|
69
|
+
# {Subscription#dead_letter_max_delivery_attempts=}.
|
70
|
+
#
|
71
|
+
# The delivery attempt counter is `1 + (the sum of number of NACKs and number of ack_deadline exceeds)` for the
|
72
|
+
# message.
|
73
|
+
#
|
74
|
+
# A NACK is any call to `ModifyAckDeadline` with a `0` deadline. An `ack_deadline` exceeds event is whenever a
|
75
|
+
# message is not acknowledged within `ack_deadline`. Note that `ack_deadline` is initially
|
76
|
+
# `Subscription.ackDeadlineSeconds`, but may get extended automatically by the client library.
|
77
|
+
#
|
78
|
+
# The first delivery of a given message will have this value as `1`. The value is calculated at best effort and
|
79
|
+
# is approximate.
|
80
|
+
#
|
81
|
+
# @return [Integer, nil] A delivery attempt value of `1` or greater, or `nil` if a dead letter policy is not set
|
82
|
+
# on the subscription.
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
# require "google/cloud/pubsub"
|
86
|
+
#
|
87
|
+
# pubsub = Google::Cloud::PubSub.new
|
88
|
+
#
|
89
|
+
# topic = pubsub.topic "my-topic"
|
90
|
+
# dead_letter_topic = pubsub.topic "my-dead-letter-topic", skip_lookup: true
|
91
|
+
# sub = topic.subscribe "my-topic-sub",
|
92
|
+
# dead_letter_topic: dead_letter_topic,
|
93
|
+
# dead_letter_max_delivery_attempts: 10
|
94
|
+
#
|
95
|
+
# subscriber = sub.listen do |received_message|
|
96
|
+
# puts received_message.message.delivery_attempt
|
97
|
+
# end
|
98
|
+
#
|
99
|
+
def delivery_attempt
|
100
|
+
return nil if @grpc.delivery_attempt && @grpc.delivery_attempt < 1
|
101
|
+
@grpc.delivery_attempt
|
102
|
+
end
|
103
|
+
|
61
104
|
##
|
62
105
|
# The received message.
|
63
106
|
def message
|
64
107
|
Message.from_grpc @grpc.message
|
65
108
|
end
|
66
|
-
|
109
|
+
alias msg message
|
67
110
|
|
68
111
|
##
|
69
|
-
# The received message
|
112
|
+
# The received message payload. This data is a list of bytes encoded as
|
113
|
+
# ASCII-8BIT.
|
70
114
|
def data
|
71
115
|
message.data
|
72
116
|
end
|
73
117
|
|
74
118
|
##
|
75
|
-
#
|
119
|
+
# Optional attributes for the received message.
|
76
120
|
def attributes
|
77
121
|
message.attributes
|
78
122
|
end
|
@@ -83,7 +127,36 @@ module Google
|
|
83
127
|
def message_id
|
84
128
|
message.message_id
|
85
129
|
end
|
86
|
-
|
130
|
+
alias msg_id message_id
|
131
|
+
|
132
|
+
##
|
133
|
+
# Identifies related messages for which publish order should be
|
134
|
+
# respected.
|
135
|
+
#
|
136
|
+
# Google Cloud Pub/Sub ordering keys provide the ability to ensure
|
137
|
+
# related messages are sent to subscribers in the order in which they
|
138
|
+
# were published. Messages can be tagged with an ordering key, a string
|
139
|
+
# that identifies related messages for which publish order should be
|
140
|
+
# respected. The service guarantees that, for a given ordering key and
|
141
|
+
# publisher, messages are sent to subscribers in the order in which they
|
142
|
+
# were published. Ordering does not require sacrificing high throughput
|
143
|
+
# or scalability, as the service automatically distributes messages for
|
144
|
+
# different ordering keys across subscribers.
|
145
|
+
#
|
146
|
+
# See {Topic#publish_async} and {Subscription#listen}.
|
147
|
+
#
|
148
|
+
# @return [String]
|
149
|
+
#
|
150
|
+
def ordering_key
|
151
|
+
message.ordering_key
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# The time at which the message was published.
|
156
|
+
def published_at
|
157
|
+
message.published_at
|
158
|
+
end
|
159
|
+
alias publish_time published_at
|
87
160
|
|
88
161
|
##
|
89
162
|
# Acknowledges receipt of the message.
|
@@ -91,20 +164,26 @@ module Google
|
|
91
164
|
# @example
|
92
165
|
# require "google/cloud/pubsub"
|
93
166
|
#
|
94
|
-
# pubsub = Google::Cloud::
|
167
|
+
# pubsub = Google::Cloud::PubSub.new
|
95
168
|
#
|
96
169
|
# sub = pubsub.subscription "my-topic-sub"
|
97
|
-
#
|
98
|
-
# if received_message
|
170
|
+
# subscriber = sub.listen do |received_message|
|
99
171
|
# puts received_message.message.data
|
172
|
+
#
|
100
173
|
# received_message.acknowledge!
|
101
174
|
# end
|
102
175
|
#
|
176
|
+
# # Start background threads that will call block passed to listen.
|
177
|
+
# subscriber.start
|
178
|
+
#
|
179
|
+
# # Shut down the subscriber when ready to stop receiving messages.
|
180
|
+
# subscriber.stop!
|
181
|
+
#
|
103
182
|
def acknowledge!
|
104
183
|
ensure_subscription!
|
105
184
|
subscription.acknowledge ack_id
|
106
185
|
end
|
107
|
-
|
186
|
+
alias ack! acknowledge!
|
108
187
|
|
109
188
|
##
|
110
189
|
# Modifies the acknowledge deadline for the message.
|
@@ -121,24 +200,81 @@ module Google
|
|
121
200
|
# @example
|
122
201
|
# require "google/cloud/pubsub"
|
123
202
|
#
|
124
|
-
# pubsub = Google::Cloud::
|
203
|
+
# pubsub = Google::Cloud::PubSub.new
|
125
204
|
#
|
126
205
|
# sub = pubsub.subscription "my-topic-sub"
|
127
|
-
#
|
128
|
-
# if received_message
|
206
|
+
# subscriber = sub.listen do |received_message|
|
129
207
|
# puts received_message.message.data
|
208
|
+
#
|
130
209
|
# # Delay for 2 minutes
|
131
|
-
# received_message.
|
210
|
+
# received_message.modify_ack_deadline! 120
|
132
211
|
# end
|
133
212
|
#
|
134
|
-
|
213
|
+
# # Start background threads that will call block passed to listen.
|
214
|
+
# subscriber.start
|
215
|
+
#
|
216
|
+
# # Shut down the subscriber when ready to stop receiving messages.
|
217
|
+
# subscriber.stop!
|
218
|
+
#
|
219
|
+
def modify_ack_deadline! new_deadline
|
135
220
|
ensure_subscription!
|
136
|
-
subscription.
|
221
|
+
subscription.modify_ack_deadline new_deadline, ack_id
|
222
|
+
end
|
223
|
+
|
224
|
+
##
|
225
|
+
# Resets the acknowledge deadline for the message without acknowledging
|
226
|
+
# it.
|
227
|
+
#
|
228
|
+
# This will make the message available for redelivery.
|
229
|
+
#
|
230
|
+
# @example
|
231
|
+
# require "google/cloud/pubsub"
|
232
|
+
#
|
233
|
+
# pubsub = Google::Cloud::PubSub.new
|
234
|
+
#
|
235
|
+
# sub = pubsub.subscription "my-topic-sub"
|
236
|
+
# subscriber = sub.listen do |received_message|
|
237
|
+
# puts received_message.message.data
|
238
|
+
#
|
239
|
+
# # Release message back to the API.
|
240
|
+
# received_message.reject!
|
241
|
+
# end
|
242
|
+
#
|
243
|
+
# # Start background threads that will call block passed to listen.
|
244
|
+
# subscriber.start
|
245
|
+
#
|
246
|
+
# # Shut down the subscriber when ready to stop receiving messages.
|
247
|
+
# subscriber.stop!
|
248
|
+
#
|
249
|
+
def reject!
|
250
|
+
modify_ack_deadline! 0
|
251
|
+
end
|
252
|
+
alias nack! reject!
|
253
|
+
alias ignore! reject!
|
254
|
+
|
255
|
+
# @private
|
256
|
+
def hash
|
257
|
+
@grpc.hash
|
258
|
+
end
|
259
|
+
|
260
|
+
# @private
|
261
|
+
def eql? other
|
262
|
+
return false unless other.is_a? self.class
|
263
|
+
@grpc.hash == other.hash
|
264
|
+
end
|
265
|
+
# @private
|
266
|
+
alias == eql?
|
267
|
+
|
268
|
+
# @private
|
269
|
+
def <=> other
|
270
|
+
return nil unless other.is_a? self.class
|
271
|
+
other_grpc = other.instance_variable_get :@grpc
|
272
|
+
@grpc <=> other_grpc
|
137
273
|
end
|
138
274
|
|
139
275
|
##
|
140
276
|
# @private New ReceivedMessage from a
|
141
|
-
# Google::
|
277
|
+
# Google::Cloud::PubSub::V1::ReceivedMessage object.
|
142
278
|
def self.from_grpc grpc, subscription
|
143
279
|
new.tap do |rm|
|
144
280
|
rm.grpc = grpc
|
@@ -151,9 +287,11 @@ module Google
|
|
151
287
|
##
|
152
288
|
# Raise an error unless an active subscription is available.
|
153
289
|
def ensure_subscription!
|
154
|
-
|
290
|
+
raise "Must have active subscription" unless subscription
|
155
291
|
end
|
156
292
|
end
|
157
293
|
end
|
294
|
+
|
295
|
+
Pubsub = PubSub unless const_defined? :Pubsub
|
158
296
|
end
|
159
297
|
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Copyright 2016 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
require "google/cloud/errors"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module PubSub
|
21
|
+
##
|
22
|
+
# # RetryPolicy
|
23
|
+
#
|
24
|
+
# An immutable Retry Policy value object that specifies how Cloud Pub/Sub retries message delivery.
|
25
|
+
#
|
26
|
+
# Retry delay will be exponential based on provided minimum and maximum backoffs. (See [Exponential
|
27
|
+
# backoff](https://en.wikipedia.org/wiki/Exponential_backoff).)
|
28
|
+
#
|
29
|
+
# Retry Policy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message.
|
30
|
+
#
|
31
|
+
# Retry Policy is implemented on a best effort basis. At times, the delay between consecutive deliveries may not
|
32
|
+
# match the configuration. That is, delay can be more or less than configured backoff.
|
33
|
+
#
|
34
|
+
# @attr [Numeric] minimum_backoff The minimum delay between consecutive deliveries of a given message. Value
|
35
|
+
# should be between 0 and 600 seconds. The default value is 10 seconds.
|
36
|
+
# @attr [Numeric] maximum_backoff The maximum delay between consecutive deliveries of a given message. Value
|
37
|
+
# should be between 0 and 600 seconds. The default value is 600 seconds.
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# require "google/cloud/pubsub"
|
41
|
+
#
|
42
|
+
# pubsub = Google::Cloud::PubSub.new
|
43
|
+
#
|
44
|
+
# sub = pubsub.subscription "my-topic-sub"
|
45
|
+
#
|
46
|
+
# sub.retry_policy = Google::Cloud::PubSub::RetryPolicy.new minimum_backoff: 5, maximum_backoff: 300
|
47
|
+
#
|
48
|
+
# sub.retry_policy.minimum_backoff #=> 5
|
49
|
+
# sub.retry_policy.maximum_backoff #=> 300
|
50
|
+
#
|
51
|
+
class RetryPolicy
|
52
|
+
attr_reader :minimum_backoff
|
53
|
+
attr_reader :maximum_backoff
|
54
|
+
|
55
|
+
##
|
56
|
+
# Creates a new, immutable RetryPolicy value object.
|
57
|
+
#
|
58
|
+
# @attr [Numeric, nil] minimum_backoff The minimum delay between consecutive deliveries of a given message.
|
59
|
+
# Value should be between 0 and 600 seconds. If `nil` is provided, the default value is 10 seconds.
|
60
|
+
# @attr [Numeric, nil] maximum_backoff The maximum delay between consecutive deliveries of a given message.
|
61
|
+
# Value should be between 0 and 600 seconds. If `nil` is provided, the default value is 600 seconds.
|
62
|
+
#
|
63
|
+
def initialize minimum_backoff: nil, maximum_backoff: nil
|
64
|
+
@minimum_backoff = minimum_backoff
|
65
|
+
@maximum_backoff = maximum_backoff
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# @private Convert the RetryPolicy to a Google::Cloud::PubSub::V1::RetryPolicy object.
|
70
|
+
def to_grpc
|
71
|
+
Google::Cloud::PubSub::V1::RetryPolicy.new(
|
72
|
+
minimum_backoff: Convert.number_to_duration(minimum_backoff),
|
73
|
+
maximum_backoff: Convert.number_to_duration(maximum_backoff)
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# @private New RetryPolicy from a Google::Cloud::PubSub::V1::RetryPolicy object.
|
79
|
+
def self.from_grpc grpc
|
80
|
+
new(
|
81
|
+
minimum_backoff: Convert.duration_to_number(grpc.minimum_backoff),
|
82
|
+
maximum_backoff: Convert.duration_to_number(grpc.maximum_backoff)
|
83
|
+
)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|