google-cloud-pubsub 2.12.0 → 2.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19d022ba204052f7d871418daa55ed9b47f9e6786abe0c2bc996eba6e31f393e
4
- data.tar.gz: 5440bfb2fa042c83d0e9ea22a3bd974c517c9d7c771b291ddbe953b7f622100f
3
+ metadata.gz: 06c05b51b56c92420e68bd4decf6cbcf91f2027c572cb89302bcae505e6a3f5b
4
+ data.tar.gz: b2072f171d8fcf1e3d7506ef86c278b5d7d60faa4dbbb0092b16fe759e1d4245
5
5
  SHA512:
6
- metadata.gz: 0a487ba4783cb96c663b7ff96311b6514ec851aca7d0985b391574ff1161b19f8aaed391fdc3571f68103c43ab3244adc6d79e9f2a13b3a99fab792139b4da56
7
- data.tar.gz: 683a30d9cd5db86e950323205007ac1e83796b386929bb41d4ed5978c1e984debdd0f7f08a273f1ff6fed4c0fcbaef4e9b5cfcfcec11c37e0ab48078ba64e50a
6
+ metadata.gz: 65446317085d8522281bbfbf84f923f6a6efa98342afd4ac4900995436ad57b91d11ce77498fda558d3f37de9fb540ac99bfd38d825bbc54267e2b0490c5c1ca
7
+ data.tar.gz: 5a421f55fd6f75449162b1c7fbba30e78bd99409a6af3e62861e9cf95e5de2699fdd76ae23dbd4806123086fa1f25077590313ddc36adeea9d9d993e34c01293
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release History
2
2
 
3
+ ### 2.13.0 (2022-10-18)
4
+
5
+ #### Features
6
+
7
+ * Added support for bigquery subscription ([#19221](https://github.com/googleapis/google-cloud-ruby/issues/19221))
8
+
9
+ ### 2.12.1 (2022-08-21)
10
+
11
+ #### Bug Fixes
12
+
13
+ * update non EOS ack to return Success always ([#19023](https://github.com/googleapis/google-cloud-ruby/issues/19023))
14
+
3
15
  ### 2.12.0 (2022-08-09)
4
16
 
5
17
  #### Features
@@ -204,7 +204,12 @@ module Google
204
204
  #
205
205
  def acknowledge! &block
206
206
  ensure_subscription!
207
- subscription.acknowledge ack_id, &block
207
+ if subscription.respond_to?(:exactly_once_delivery_enabled) && subscription.exactly_once_delivery_enabled
208
+ subscription.acknowledge ack_id, &block
209
+ else
210
+ subscription.acknowledge ack_id
211
+ yield AcknowledgeResult.new(AcknowledgeResult::SUCCESS) if block_given?
212
+ end
208
213
  end
209
214
  alias ack! acknowledge!
210
215
 
@@ -265,7 +270,12 @@ module Google
265
270
  #
266
271
  def modify_ack_deadline! new_deadline, &block
267
272
  ensure_subscription!
268
- subscription.modify_ack_deadline new_deadline, ack_id, &block
273
+ if subscription.respond_to?(:exactly_once_delivery_enabled) && subscription.exactly_once_delivery_enabled
274
+ subscription.modify_ack_deadline new_deadline, ack_id, &block
275
+ else
276
+ subscription.modify_ack_deadline new_deadline, ack_id
277
+ yield AcknowledgeResult.new(AcknowledgeResult::SUCCESS) if block_given?
278
+ end
269
279
  end
270
280
 
271
281
  ##
@@ -35,11 +35,11 @@ module Google
35
35
 
36
36
  PERMANENT_FAILURE = "PERMANENT_FAILURE".freeze
37
37
  # Google::Cloud::Unavailable error is already retried at gapic level
38
- RETRIABLE_ERRORS = [Google::Cloud::CanceledError,
39
- Google::Cloud::DeadlineExceededError,
40
- Google::Cloud::InternalError,
41
- Google::Cloud::ResourceExhaustedError,
42
- Google::Cloud::InvalidArgumentError].freeze
38
+ EXACTLY_ONCE_DELIVERY_POSSIBLE_RETRIABLE_ERRORS = [Google::Cloud::CanceledError,
39
+ Google::Cloud::DeadlineExceededError,
40
+ Google::Cloud::InternalError,
41
+ Google::Cloud::ResourceExhaustedError,
42
+ Google::Cloud::InvalidArgumentError].freeze
43
43
  MAX_RETRY_DURATION = 600 # 600s since the server allows ack/modacks for 10 mins max
44
44
  MAX_TRIES = 15
45
45
  BASE_INTERVAL = 1
@@ -128,7 +128,7 @@ module Google
128
128
  begin
129
129
  @subscriber.service.acknowledge ack_req.subscription, *ack_req.ack_ids
130
130
  handle_callback AcknowledgeResult.new(AcknowledgeResult::SUCCESS), ack_req.ack_ids
131
- rescue *RETRIABLE_ERRORS => e
131
+ rescue *EXACTLY_ONCE_DELIVERY_POSSIBLE_RETRIABLE_ERRORS => e
132
132
  handle_failure e, ack_req.ack_ids if @subscriber.exactly_once_delivery_enabled
133
133
  rescue StandardError => e
134
134
  handle_callback construct_result(e), ack_req.ack_ids
@@ -146,7 +146,7 @@ module Google
146
146
  handle_callback AcknowledgeResult.new(AcknowledgeResult::SUCCESS),
147
147
  mod_ack_req.ack_ids,
148
148
  modack: true
149
- rescue *RETRIABLE_ERRORS => e
149
+ rescue *EXACTLY_ONCE_DELIVERY_POSSIBLE_RETRIABLE_ERRORS => e
150
150
  if @subscriber.exactly_once_delivery_enabled
151
151
  handle_failure e, mod_ack_req.ack_ids, mod_ack_req.ack_deadline_seconds
152
152
  end
@@ -276,7 +276,7 @@ module Google
276
276
  max_interval: MAX_INTERVAL,
277
277
  multiplier: MULTIPLIER,
278
278
  max_elapsed_time: MAX_RETRY_DURATION,
279
- on: RETRIABLE_ERRORS do
279
+ on: EXACTLY_ONCE_DELIVERY_POSSIBLE_RETRIABLE_ERRORS do
280
280
  return if ack_ids.nil?
281
281
  begin
282
282
  yield ack_ids
@@ -303,6 +303,56 @@ module Google
303
303
  config.freeze
304
304
  end
305
305
 
306
+ ##
307
+ # Inspect the Subscription's bigquery configuration settings. The
308
+ # configuration can be changed by modifying the values in the method's
309
+ # block.
310
+ #
311
+ # @yield [bigquery_config] a block for modifying the bigquery configuration
312
+ # @yieldparam [Google::Cloud::PubSub::V1::BigQueryConfig] bigquery_config
313
+ #
314
+ # @return [Google::Cloud::PubSub::V1::BigQueryConfig]
315
+ #
316
+ # @example
317
+ # require "google/cloud/pubsub"
318
+ #
319
+ # pubsub = Google::Cloud::PubSub.new
320
+ #
321
+ # sub = pubsub.subscription "my-topic-sub"
322
+ # sub.bigquery_config.table #=> "my-project:dataset-id.table-id"
323
+ # sub.bigquery_config.use_topic_schema #=> true
324
+ # sub.bigquery_config.write_metadata #=> false
325
+ #
326
+ # @example Update the bigquery configuration by passing a block:
327
+ # require "google/cloud/pubsub"
328
+ #
329
+ # pubsub = Google::Cloud::PubSub.new
330
+ # sub = pubsub.subscription "my-subscription"
331
+ #
332
+ # sub.bigquery_config do |bc|
333
+ # bc.write_metadata = true
334
+ # bc.use_topic_schema = false
335
+ # end
336
+ #
337
+ def bigquery_config
338
+ ensure_service!
339
+
340
+ config = reference? ? Google::Cloud::PubSub::V1::BigQueryConfig.new : @grpc.bigquery_config
341
+
342
+ if block_given?
343
+ old_config = config.dup
344
+ yield config
345
+ new_config = config
346
+
347
+ if old_config != new_config # has the object been changed?
348
+ update_grpc = Google::Cloud::PubSub::V1::Subscription.new name: name, bigquery_config: new_config
349
+ @grpc = service.update_subscription update_grpc, :bigquery_config
350
+ end
351
+ end
352
+
353
+ config.freeze
354
+ end
355
+
306
356
  ##
307
357
  # A hash of user-provided labels associated with this subscription.
308
358
  # Labels can be used to organize and group subscriptions.See [Creating
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "2.12.0".freeze
19
+ VERSION = "2.13.0".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
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.12.0
4
+ version: 2.13.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: 2022-08-09 00:00:00.000000000 Z
12
+ date: 2022-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby