google-cloud-pubsub 1.7.1 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25d3602668077c7dee90a868dcc01353710ac3001ece8ebe92b7acc6c7bc1bb3
4
- data.tar.gz: 2119781ea548d6e87d201bdb759643c7ac78b7ffab0a4ee7505f731c3c812670
3
+ metadata.gz: 5dc069dbd6e0c8e77d39c6a27b148755fe6935d58ca2af7babc2c167c22513e0
4
+ data.tar.gz: b2509a217ba7e2a76675a95e1b95884c1e285224c8b194af9299e56aedf9ceea
5
5
  SHA512:
6
- metadata.gz: ed1de151bbd790feb886162024dbe20e75825c7313de7f0349468d8adbdf0400ce0616f53925315a1a2558b2683fd9ac8b478b842b2008dae67990676c163a4b
7
- data.tar.gz: 2247b98b5f04c936bd908c7a517d396e03af0f07030e7939282f750d8d2b9f569f428961c793f929d5595da60445a55948fe17864a1f25f1ab7d1746b06be9c0
6
+ metadata.gz: e5d900b940dd93fb85be47f23f233d9183a5cb150a18a7e93687ed4dba45ece70d044129ccc5162477f0bc4a58b439c25b7aca2cc3ccdc5dc1ff7434b869b5e6
7
+ data.tar.gz: 4e5960220728a2ab73ff69ee3da5a6e11322a6fb1c50d40d7aadaffb7adf26d01383a9972d15ea2af0ed29b3b867f8b05b4194dac55db9f3c808eeea55030e51
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 1.8.0 / 2020-06-29
4
+
5
+ #### Features
6
+
7
+ * Add Subscription#filter
8
+
3
9
  ### 1.7.1 / 2020-05-28
4
10
 
5
11
  #### Documentation
@@ -241,20 +241,17 @@ module Google
241
241
  push_endpoint: options[:endpoint],
242
242
  attributes: (options[:attributes] || {}).to_h
243
243
  end
244
- deadline = options[:deadline]
245
- retain_acked = options[:retain_acked]
246
244
  mrd = Convert.number_to_duration options[:retention]
247
- labels = options[:labels]
248
- message_ordering = options[:message_ordering]
249
245
  execute do
250
246
  subscriber.create_subscription \
251
247
  name, topic,
252
248
  push_config: push_config,
253
- ack_deadline_seconds: deadline,
254
- retain_acked_messages: retain_acked,
249
+ ack_deadline_seconds: options[:deadline],
250
+ retain_acked_messages: options[:retain_acked],
255
251
  message_retention_duration: mrd,
256
- labels: labels,
257
- enable_message_ordering: message_ordering,
252
+ labels: options[:labels],
253
+ enable_message_ordering: options[:message_ordering],
254
+ filter: options[:filter],
258
255
  dead_letter_policy: dead_letter_policy(options),
259
256
  retry_policy: options[:retry_policy],
260
257
  options: default_options
@@ -353,6 +353,18 @@ module Google
353
353
  @resource_name = nil
354
354
  end
355
355
 
356
+ ##
357
+ # An expression written in the Cloud Pub/Sub filter language. If non-empty, then only {Message} instances whose
358
+ # `attributes` field matches the filter are delivered on this subscription. If empty, then no messages are
359
+ # filtered out.
360
+ #
361
+ # @return [String] The frozen filter string.
362
+ #
363
+ def filter
364
+ ensure_grpc!
365
+ @grpc.filter.freeze
366
+ end
367
+
356
368
  ##
357
369
  # Returns the {Topic} to which dead letter messages should be published if a dead letter policy is configured,
358
370
  # otherwise `nil`. Dead lettering is done on a best effort basis. The same message might be dead lettered
@@ -286,6 +286,9 @@ module Google
286
286
  # Managing Labels](https://cloud.google.com/pubsub/docs/labels).
287
287
  # @param [Boolean] message_ordering Whether to enable message ordering
288
288
  # on the subscription.
289
+ # @param [String] filter An expression written in the Cloud Pub/Sub filter language. If non-empty, then only
290
+ # {Message} instances whose `attributes` field matches the filter are delivered on this subscription. If
291
+ # empty, then no messages are filtered out. Optional.
289
292
  # @param [Topic] dead_letter_topic The {Topic} to which dead letter messages for the subscription should be
290
293
  # published. Dead lettering is done on a best effort basis. The same message might be dead lettered multiple
291
294
  # times. The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e.,
@@ -359,11 +362,11 @@ module Google
359
362
  # sub = topic.subscribe "my-topic-sub", retry_policy: retry_policy
360
363
  #
361
364
  def subscribe subscription_name, deadline: nil, retain_acked: false, retention: nil, endpoint: nil, labels: nil,
362
- message_ordering: nil, dead_letter_topic: nil, dead_letter_max_delivery_attempts: nil,
363
- retry_policy: nil
365
+ message_ordering: nil, filter: nil, dead_letter_topic: nil,
366
+ dead_letter_max_delivery_attempts: nil, retry_policy: nil
364
367
  ensure_service!
365
368
  options = { deadline: deadline, retain_acked: retain_acked, retention: retention, endpoint: endpoint,
366
- labels: labels, message_ordering: message_ordering,
369
+ labels: labels, message_ordering: message_ordering, filter: filter,
367
370
  dead_letter_max_delivery_attempts: dead_letter_max_delivery_attempts }
368
371
  options[:dead_letter_topic_name] = dead_letter_topic.name if dead_letter_topic
369
372
  if options[:dead_letter_max_delivery_attempts] && !options[:dead_letter_topic_name]
@@ -17,6 +17,7 @@ module Google
17
17
  module Cloud
18
18
  module PubSub
19
19
  module V1
20
+ # A policy constraining the storage of messages published to the topic.
20
21
  # @!attribute [rw] allowed_persistence_regions
21
22
  # @return [Array<String>]
22
23
  # A list of IDs of GCP regions where messages that are published to the topic
@@ -67,7 +68,8 @@ module Google
67
68
  # @!attribute [rw] attributes
68
69
  # @return [Hash{String => String}]
69
70
  # Attributes for this message. If this field is empty, the message must
70
- # contain non-empty data.
71
+ # contain non-empty data. This can be used to filter messages on the
72
+ # subscription.
71
73
  # @!attribute [rw] message_id
72
74
  # @return [String]
73
75
  # ID of this message, assigned by the server when the message is published.
@@ -306,13 +308,11 @@ module Google
306
308
  # value for `expiration_policy.ttl` is 1 day.
307
309
  # @!attribute [rw] filter
308
310
  # @return [String]
309
- # An expression written in the Cloud Pub/Sub filter language. If non-empty,
311
+ # An expression written in the Pub/Sub [filter
312
+ # language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
310
313
  # then only `PubsubMessage`s whose `attributes` field matches the filter are
311
314
  # delivered on this subscription. If empty, then no messages are filtered
312
315
  # out.
313
- # <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
314
- # API might be changed in backward-incompatible ways and is not recommended
315
- # for production use. It is not subject to any SLA or deprecation policy.
316
316
  # @!attribute [rw] dead_letter_policy
317
317
  # @return [Google::Cloud::PubSub::V1::DeadLetterPolicy]
318
318
  # A policy that specifies the conditions for dead lettering messages in
@@ -325,16 +325,20 @@ module Google
325
325
  # permission to Acknowledge() messages on this subscription.
326
326
  # @!attribute [rw] retry_policy
327
327
  # @return [Google::Cloud::PubSub::V1::RetryPolicy]
328
- # A policy that specifies how Cloud Pub/Sub retries message delivery for this
328
+ # A policy that specifies how Pub/Sub retries message delivery for this
329
329
  # subscription.
330
330
  #
331
331
  # If not set, the default retry policy is applied. This generally implies
332
332
  # that messages will be retried as soon as possible for healthy subscribers.
333
333
  # RetryPolicy will be triggered on NACKs or acknowledgement deadline
334
334
  # exceeded events for a given message.
335
- # <b>EXPERIMENTAL:</b> This API might be changed in backward-incompatible
336
- # ways and is not recommended for production use. It is not subject to any
337
- # SLA or deprecation policy.
335
+ # @!attribute [rw] detached
336
+ # @return [true, false]
337
+ # Indicates whether the subscription is detached from its topic. Detached
338
+ # subscriptions don't receive messages from their topic and don't retain any
339
+ # backlog. `Pull` and `StreamingPull` requests will return
340
+ # FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
341
+ # the endpoint will not be made.
338
342
  class Subscription; end
339
343
 
340
344
  # A policy that specifies how Cloud Pub/Sub retries message delivery.
@@ -661,6 +665,28 @@ module Google
661
665
  # to the same value so that state associated with the old stream can be
662
666
  # transferred to the new stream. The same client_id should not be used for
663
667
  # different client instances.
668
+ # @!attribute [rw] max_outstanding_messages
669
+ # @return [Integer]
670
+ # Flow control settings for the maximum number of outstanding messages. When
671
+ # there are `max_outstanding_messages` or more currently sent to the
672
+ # streaming pull client that have not yet been acked or nacked, the server
673
+ # stops sending more messages. The sending of messages resumes once the
674
+ # number of outstanding messages is less than this value. If the value is
675
+ # <= 0, there is no limit to the number of outstanding messages. This
676
+ # property can only be set on the initial StreamingPullRequest. If it is set
677
+ # on a subsequent request, the stream will be aborted with status
678
+ # `INVALID_ARGUMENT`.
679
+ # @!attribute [rw] max_outstanding_bytes
680
+ # @return [Integer]
681
+ # Flow control settings for the maximum number of outstanding bytes. When
682
+ # there are `max_outstanding_bytes` or more worth of messages currently sent
683
+ # to the streaming pull client that have not yet been acked or nacked, the
684
+ # server will stop sending more messages. The sending of messages resumes
685
+ # once the number of outstanding bytes is less than this value. If the value
686
+ # is <= 0, there is no limit to the number of outstanding bytes. This
687
+ # property can only be set on the initial StreamingPullRequest. If it is set
688
+ # on a subsequent request, the stream will be aborted with status
689
+ # `INVALID_ARGUMENT`.
664
690
  class StreamingPullRequest; end
665
691
 
666
692
  # Response for the `StreamingPull` method. This response is used to stream
@@ -510,13 +510,11 @@ module Google
510
510
  # A hash of the same form as `Google::Cloud::PubSub::V1::ExpirationPolicy`
511
511
  # can also be provided.
512
512
  # @param filter [String]
513
- # An expression written in the Cloud Pub/Sub filter language. If non-empty,
513
+ # An expression written in the Pub/Sub [filter
514
+ # language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
514
515
  # then only `PubsubMessage`s whose `attributes` field matches the filter are
515
516
  # delivered on this subscription. If empty, then no messages are filtered
516
517
  # out.
517
- # <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
518
- # API might be changed in backward-incompatible ways and is not recommended
519
- # for production use. It is not subject to any SLA or deprecation policy.
520
518
  # @param dead_letter_policy [Google::Cloud::PubSub::V1::DeadLetterPolicy | Hash]
521
519
  # A policy that specifies the conditions for dead lettering messages in
522
520
  # this subscription. If dead_letter_policy is not set, dead lettering
@@ -529,18 +527,21 @@ module Google
529
527
  # A hash of the same form as `Google::Cloud::PubSub::V1::DeadLetterPolicy`
530
528
  # can also be provided.
531
529
  # @param retry_policy [Google::Cloud::PubSub::V1::RetryPolicy | Hash]
532
- # A policy that specifies how Cloud Pub/Sub retries message delivery for this
530
+ # A policy that specifies how Pub/Sub retries message delivery for this
533
531
  # subscription.
534
532
  #
535
533
  # If not set, the default retry policy is applied. This generally implies
536
534
  # that messages will be retried as soon as possible for healthy subscribers.
537
535
  # RetryPolicy will be triggered on NACKs or acknowledgement deadline
538
536
  # exceeded events for a given message.
539
- # <b>EXPERIMENTAL:</b> This API might be changed in backward-incompatible
540
- # ways and is not recommended for production use. It is not subject to any
541
- # SLA or deprecation policy.
542
537
  # A hash of the same form as `Google::Cloud::PubSub::V1::RetryPolicy`
543
538
  # can also be provided.
539
+ # @param detached [true, false]
540
+ # Indicates whether the subscription is detached from its topic. Detached
541
+ # subscriptions don't receive messages from their topic and don't retain any
542
+ # backlog. `Pull` and `StreamingPull` requests will return
543
+ # FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
544
+ # the endpoint will not be made.
544
545
  # @param options [Google::Gax::CallOptions]
545
546
  # Overrides the default settings for this call, e.g, timeout,
546
547
  # retries, etc.
@@ -570,6 +571,7 @@ module Google
570
571
  filter: nil,
571
572
  dead_letter_policy: nil,
572
573
  retry_policy: nil,
574
+ detached: nil,
573
575
  options: nil,
574
576
  &block
575
577
  req = {
@@ -584,7 +586,8 @@ module Google
584
586
  expiration_policy: expiration_policy,
585
587
  filter: filter,
586
588
  dead_letter_policy: dead_letter_policy,
587
- retry_policy: retry_policy
589
+ retry_policy: retry_policy,
590
+ detached: detached
588
591
  }.delete_if { |_, v| v.nil? }
589
592
  req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::Subscription)
590
593
  @create_subscription.call(req, options, &block)
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "1.7.1".freeze
19
+ VERSION = "1.8.0".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
@@ -91,6 +91,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
91
91
  optional :filter, :string, 12
92
92
  optional :dead_letter_policy, :message, 13, "google.pubsub.v1.DeadLetterPolicy"
93
93
  optional :retry_policy, :message, 14, "google.pubsub.v1.RetryPolicy"
94
+ optional :detached, :bool, 15
94
95
  end
95
96
  add_message "google.pubsub.v1.RetryPolicy" do
96
97
  optional :minimum_backoff, :message, 1, "google.protobuf.Duration"
@@ -166,6 +167,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
166
167
  repeated :modify_deadline_ack_ids, :string, 4
167
168
  optional :stream_ack_deadline_seconds, :int32, 5
168
169
  optional :client_id, :string, 6
170
+ optional :max_outstanding_messages, :int64, 7
171
+ optional :max_outstanding_bytes, :int64, 8
169
172
  end
170
173
  add_message "google.pubsub.v1.StreamingPullResponse" do
171
174
  repeated :received_messages, :message, 1, "google.pubsub.v1.ReceivedMessage"
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: 1.7.1
4
+ version: 1.8.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: 2020-05-28 00:00:00.000000000 Z
12
+ date: 2020-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -330,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
330
  - !ruby/object:Gem::Version
331
331
  version: '0'
332
332
  requirements: []
333
- rubygems_version: 3.0.6
333
+ rubygems_version: 3.1.3
334
334
  signing_key:
335
335
  specification_version: 4
336
336
  summary: API Client library for Google Cloud Pub/Sub