google-cloud-pubsub 1.4.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +43 -0
- data/EMULATOR.md +1 -1
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google/cloud/pubsub/received_message.rb +0 -5
- data/lib/google/cloud/pubsub/retry_policy.rb +90 -0
- data/lib/google/cloud/pubsub/service.rb +9 -0
- data/lib/google/cloud/pubsub/subscriber.rb +29 -3
- data/lib/google/cloud/pubsub/subscriber/inventory.rb +6 -3
- data/lib/google/cloud/pubsub/subscriber/stream.rb +1 -0
- data/lib/google/cloud/pubsub/subscription.rb +84 -2
- data/lib/google/cloud/pubsub/subscription/push_config.rb +2 -2
- data/lib/google/cloud/pubsub/topic.rb +21 -1
- data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +65 -15
- data/lib/google/cloud/pubsub/v1/publisher_client.rb +151 -14
- data/lib/google/cloud/pubsub/v1/publisher_client_config.json +15 -0
- data/lib/google/cloud/pubsub/v1/subscriber_client.rb +84 -13
- data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +9 -0
- data/lib/google/cloud/pubsub/version.rb +1 -1
- data/lib/google/pubsub/v1/pubsub_pb.rb +14 -0
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +6 -1
- metadata +5 -4
@@ -7,9 +7,14 @@
|
|
7
7
|
"UNAVAILABLE",
|
8
8
|
"UNKNOWN"
|
9
9
|
],
|
10
|
+
"non_idempotent2": [],
|
10
11
|
"non_idempotent": [
|
11
12
|
"UNAVAILABLE"
|
12
13
|
],
|
14
|
+
"idempotent2": [
|
15
|
+
"DEADLINE_EXCEEDED",
|
16
|
+
"UNAVAILABLE"
|
17
|
+
],
|
13
18
|
"none": [],
|
14
19
|
"publish": [
|
15
20
|
"ABORTED",
|
@@ -79,6 +84,11 @@
|
|
79
84
|
"retry_codes_name": "idempotent",
|
80
85
|
"retry_params_name": "default"
|
81
86
|
},
|
87
|
+
"ListTopicSnapshots": {
|
88
|
+
"timeout_millis": 60000,
|
89
|
+
"retry_codes_name": "idempotent2",
|
90
|
+
"retry_params_name": "default"
|
91
|
+
},
|
82
92
|
"DeleteTopic": {
|
83
93
|
"timeout_millis": 60000,
|
84
94
|
"retry_codes_name": "non_idempotent",
|
@@ -98,6 +108,11 @@
|
|
98
108
|
"timeout_millis": 60000,
|
99
109
|
"retry_codes_name": "non_idempotent",
|
100
110
|
"retry_params_name": "default"
|
111
|
+
},
|
112
|
+
"DetachSubscription": {
|
113
|
+
"timeout_millis": 60000,
|
114
|
+
"retry_codes_name": "non_idempotent2",
|
115
|
+
"retry_params_name": "default"
|
101
116
|
}
|
102
117
|
}
|
103
118
|
}
|
@@ -307,6 +307,14 @@ module Google
|
|
307
307
|
{'subscription' => request.subscription}
|
308
308
|
end
|
309
309
|
)
|
310
|
+
@get_snapshot = Google::Gax.create_api_call(
|
311
|
+
@subscriber_stub.method(:get_snapshot),
|
312
|
+
defaults["get_snapshot"],
|
313
|
+
exception_transformer: exception_transformer,
|
314
|
+
params_extractor: proc do |request|
|
315
|
+
{'snapshot' => request.snapshot}
|
316
|
+
end
|
317
|
+
)
|
310
318
|
@modify_ack_deadline = Google::Gax.create_api_call(
|
311
319
|
@subscriber_stub.method(:modify_ack_deadline),
|
312
320
|
defaults["modify_ack_deadline"],
|
@@ -501,6 +509,14 @@ module Google
|
|
501
509
|
# value for `expiration_policy.ttl` is 1 day.
|
502
510
|
# A hash of the same form as `Google::Cloud::PubSub::V1::ExpirationPolicy`
|
503
511
|
# can also be provided.
|
512
|
+
# @param filter [String]
|
513
|
+
# An expression written in the Cloud Pub/Sub filter language. If non-empty,
|
514
|
+
# then only `PubsubMessage`s whose `attributes` field matches the filter are
|
515
|
+
# delivered on this subscription. If empty, then no messages are filtered
|
516
|
+
# 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.
|
504
520
|
# @param dead_letter_policy [Google::Cloud::PubSub::V1::DeadLetterPolicy | Hash]
|
505
521
|
# A policy that specifies the conditions for dead lettering messages in
|
506
522
|
# this subscription. If dead_letter_policy is not set, dead lettering
|
@@ -510,11 +526,21 @@ module Google
|
|
510
526
|
# parent project (i.e.,
|
511
527
|
# service-\\{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
|
512
528
|
# permission to Acknowledge() messages on this subscription.
|
513
|
-
# <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
|
514
|
-
# API might be changed in backward-incompatible ways and is not recommended
|
515
|
-
# for production use. It is not subject to any SLA or deprecation policy.
|
516
529
|
# A hash of the same form as `Google::Cloud::PubSub::V1::DeadLetterPolicy`
|
517
530
|
# can also be provided.
|
531
|
+
# @param retry_policy [Google::Cloud::PubSub::V1::RetryPolicy | Hash]
|
532
|
+
# A policy that specifies how Cloud Pub/Sub retries message delivery for this
|
533
|
+
# subscription.
|
534
|
+
#
|
535
|
+
# If not set, the default retry policy is applied. This generally implies
|
536
|
+
# that messages will be retried as soon as possible for healthy subscribers.
|
537
|
+
# RetryPolicy will be triggered on NACKs or acknowledgement deadline
|
538
|
+
# 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
|
+
# A hash of the same form as `Google::Cloud::PubSub::V1::RetryPolicy`
|
543
|
+
# can also be provided.
|
518
544
|
# @param options [Google::Gax::CallOptions]
|
519
545
|
# Overrides the default settings for this call, e.g, timeout,
|
520
546
|
# retries, etc.
|
@@ -541,7 +567,9 @@ module Google
|
|
541
567
|
labels: nil,
|
542
568
|
enable_message_ordering: nil,
|
543
569
|
expiration_policy: nil,
|
570
|
+
filter: nil,
|
544
571
|
dead_letter_policy: nil,
|
572
|
+
retry_policy: nil,
|
545
573
|
options: nil,
|
546
574
|
&block
|
547
575
|
req = {
|
@@ -554,7 +582,9 @@ module Google
|
|
554
582
|
labels: labels,
|
555
583
|
enable_message_ordering: enable_message_ordering,
|
556
584
|
expiration_policy: expiration_policy,
|
557
|
-
|
585
|
+
filter: filter,
|
586
|
+
dead_letter_policy: dead_letter_policy,
|
587
|
+
retry_policy: retry_policy
|
558
588
|
}.delete_if { |_, v| v.nil? }
|
559
589
|
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::Subscription)
|
560
590
|
@create_subscription.call(req, options, &block)
|
@@ -725,6 +755,41 @@ module Google
|
|
725
755
|
nil
|
726
756
|
end
|
727
757
|
|
758
|
+
# Gets the configuration details of a snapshot. Snapshots are used in
|
759
|
+
# <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
|
760
|
+
# operations, which allow you to manage message acknowledgments in bulk. That
|
761
|
+
# is, you can set the acknowledgment state of messages in an existing
|
762
|
+
# subscription to the state captured by a snapshot.
|
763
|
+
#
|
764
|
+
# @param snapshot [String]
|
765
|
+
# Required. The name of the snapshot to get.
|
766
|
+
# Format is `projects/{project}/snapshots/{snap}`.
|
767
|
+
# @param options [Google::Gax::CallOptions]
|
768
|
+
# Overrides the default settings for this call, e.g, timeout,
|
769
|
+
# retries, etc.
|
770
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
771
|
+
# @yieldparam result [Google::Cloud::PubSub::V1::Snapshot]
|
772
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
773
|
+
# @return [Google::Cloud::PubSub::V1::Snapshot]
|
774
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
775
|
+
# @example
|
776
|
+
# require "google/cloud/pubsub"
|
777
|
+
#
|
778
|
+
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
779
|
+
# formatted_snapshot = Google::Cloud::PubSub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
|
780
|
+
# response = subscriber_client.get_snapshot(formatted_snapshot)
|
781
|
+
|
782
|
+
def get_snapshot \
|
783
|
+
snapshot,
|
784
|
+
options: nil,
|
785
|
+
&block
|
786
|
+
req = {
|
787
|
+
snapshot: snapshot
|
788
|
+
}.delete_if { |_, v| v.nil? }
|
789
|
+
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::GetSnapshotRequest)
|
790
|
+
@get_snapshot.call(req, options, &block)
|
791
|
+
end
|
792
|
+
|
728
793
|
# Modifies the ack deadline for a specific message. This method is useful
|
729
794
|
# to indicate that more time is needed to process a message by the
|
730
795
|
# subscriber, or to make the message available for redelivery if the
|
@@ -1254,8 +1319,8 @@ module Google
|
|
1254
1319
|
# Sets the access control policy on the specified resource. Replaces
|
1255
1320
|
# any existing policy.
|
1256
1321
|
#
|
1257
|
-
# Can return
|
1258
|
-
#
|
1322
|
+
# Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
|
1323
|
+
# errors.
|
1259
1324
|
#
|
1260
1325
|
# @param resource [String]
|
1261
1326
|
# REQUIRED: The resource for which the policy is being specified.
|
@@ -1279,11 +1344,13 @@ module Google
|
|
1279
1344
|
# require "google/cloud/pubsub"
|
1280
1345
|
#
|
1281
1346
|
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1282
|
-
#
|
1347
|
+
#
|
1348
|
+
# # TODO: Initialize `resource`:
|
1349
|
+
# resource = ''
|
1283
1350
|
#
|
1284
1351
|
# # TODO: Initialize `policy`:
|
1285
1352
|
# policy = {}
|
1286
|
-
# response = subscriber_client.set_iam_policy(
|
1353
|
+
# response = subscriber_client.set_iam_policy(resource, policy)
|
1287
1354
|
|
1288
1355
|
def set_iam_policy \
|
1289
1356
|
resource,
|
@@ -1321,8 +1388,10 @@ module Google
|
|
1321
1388
|
# require "google/cloud/pubsub"
|
1322
1389
|
#
|
1323
1390
|
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1324
|
-
#
|
1325
|
-
#
|
1391
|
+
#
|
1392
|
+
# # TODO: Initialize `resource`:
|
1393
|
+
# resource = ''
|
1394
|
+
# response = subscriber_client.get_iam_policy(resource)
|
1326
1395
|
|
1327
1396
|
def get_iam_policy \
|
1328
1397
|
resource,
|
@@ -1339,7 +1408,7 @@ module Google
|
|
1339
1408
|
|
1340
1409
|
# Returns permissions that a caller has on the specified resource. If the
|
1341
1410
|
# resource does not exist, this will return an empty set of
|
1342
|
-
# permissions, not a NOT_FOUND error.
|
1411
|
+
# permissions, not a `NOT_FOUND` error.
|
1343
1412
|
#
|
1344
1413
|
# Note: This operation is designed to be used for building
|
1345
1414
|
# permission-aware UIs and command-line tools, not for authorization
|
@@ -1365,11 +1434,13 @@ module Google
|
|
1365
1434
|
# require "google/cloud/pubsub"
|
1366
1435
|
#
|
1367
1436
|
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1368
|
-
#
|
1437
|
+
#
|
1438
|
+
# # TODO: Initialize `resource`:
|
1439
|
+
# resource = ''
|
1369
1440
|
#
|
1370
1441
|
# # TODO: Initialize `permissions`:
|
1371
1442
|
# permissions = []
|
1372
|
-
# response = subscriber_client.test_iam_permissions(
|
1443
|
+
# response = subscriber_client.test_iam_permissions(resource, permissions)
|
1373
1444
|
|
1374
1445
|
def test_iam_permissions \
|
1375
1446
|
resource,
|
@@ -10,6 +10,10 @@
|
|
10
10
|
"non_idempotent": [
|
11
11
|
"UNAVAILABLE"
|
12
12
|
],
|
13
|
+
"idempotent2": [
|
14
|
+
"DEADLINE_EXCEEDED",
|
15
|
+
"UNAVAILABLE"
|
16
|
+
],
|
13
17
|
"streaming_pull": [
|
14
18
|
"ABORTED",
|
15
19
|
"DEADLINE_EXCEEDED",
|
@@ -73,6 +77,11 @@
|
|
73
77
|
"retry_codes_name": "non_idempotent",
|
74
78
|
"retry_params_name": "default"
|
75
79
|
},
|
80
|
+
"GetSnapshot": {
|
81
|
+
"timeout_millis": 60000,
|
82
|
+
"retry_codes_name": "idempotent2",
|
83
|
+
"retry_params_name": "default"
|
84
|
+
},
|
76
85
|
"ModifyAckDeadline": {
|
77
86
|
"timeout_millis": 60000,
|
78
87
|
"retry_codes_name": "non_idempotent",
|
@@ -73,6 +73,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
73
73
|
add_message "google.pubsub.v1.DeleteTopicRequest" do
|
74
74
|
optional :topic, :string, 1
|
75
75
|
end
|
76
|
+
add_message "google.pubsub.v1.DetachSubscriptionRequest" do
|
77
|
+
optional :subscription, :string, 1
|
78
|
+
end
|
79
|
+
add_message "google.pubsub.v1.DetachSubscriptionResponse" do
|
80
|
+
end
|
76
81
|
add_message "google.pubsub.v1.Subscription" do
|
77
82
|
optional :name, :string, 1
|
78
83
|
optional :topic, :string, 2
|
@@ -83,7 +88,13 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
83
88
|
map :labels, :string, :string, 9
|
84
89
|
optional :enable_message_ordering, :bool, 10
|
85
90
|
optional :expiration_policy, :message, 11, "google.pubsub.v1.ExpirationPolicy"
|
91
|
+
optional :filter, :string, 12
|
86
92
|
optional :dead_letter_policy, :message, 13, "google.pubsub.v1.DeadLetterPolicy"
|
93
|
+
optional :retry_policy, :message, 14, "google.pubsub.v1.RetryPolicy"
|
94
|
+
end
|
95
|
+
add_message "google.pubsub.v1.RetryPolicy" do
|
96
|
+
optional :minimum_backoff, :message, 1, "google.protobuf.Duration"
|
97
|
+
optional :maximum_backoff, :message, 2, "google.protobuf.Duration"
|
87
98
|
end
|
88
99
|
add_message "google.pubsub.v1.DeadLetterPolicy" do
|
89
100
|
optional :dead_letter_topic, :string, 1
|
@@ -222,7 +233,10 @@ module Google::Cloud::PubSub::V1
|
|
222
233
|
ListTopicSnapshotsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.ListTopicSnapshotsRequest").msgclass
|
223
234
|
ListTopicSnapshotsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.ListTopicSnapshotsResponse").msgclass
|
224
235
|
DeleteTopicRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.DeleteTopicRequest").msgclass
|
236
|
+
DetachSubscriptionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.DetachSubscriptionRequest").msgclass
|
237
|
+
DetachSubscriptionResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.DetachSubscriptionResponse").msgclass
|
225
238
|
Subscription = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.Subscription").msgclass
|
239
|
+
RetryPolicy = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.RetryPolicy").msgclass
|
226
240
|
DeadLetterPolicy = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.DeadLetterPolicy").msgclass
|
227
241
|
ExpirationPolicy = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.ExpirationPolicy").msgclass
|
228
242
|
PushConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.pubsub.v1.PushConfig").msgclass
|
@@ -53,7 +53,7 @@ module Google::Cloud::PubSub::V1
|
|
53
53
|
rpc :GetTopic, GetTopicRequest, Topic
|
54
54
|
# Lists matching topics.
|
55
55
|
rpc :ListTopics, ListTopicsRequest, ListTopicsResponse
|
56
|
-
# Lists the names of the subscriptions on this topic.
|
56
|
+
# Lists the names of the attached subscriptions on this topic.
|
57
57
|
rpc :ListTopicSubscriptions, ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse
|
58
58
|
# Lists the names of the snapshots on this topic. Snapshots are used in
|
59
59
|
# <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
|
@@ -68,6 +68,11 @@ module Google::Cloud::PubSub::V1
|
|
68
68
|
# configuration or subscriptions. Existing subscriptions to this topic are
|
69
69
|
# not deleted, but their `topic` field is set to `_deleted-topic_`.
|
70
70
|
rpc :DeleteTopic, DeleteTopicRequest, Google::Protobuf::Empty
|
71
|
+
# Detaches a subscription from this topic. All messages retained in the
|
72
|
+
# subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
|
73
|
+
# will return FAILED_PRECONDITION. If the subscription is a push
|
74
|
+
# subscription, pushes to the endpoint will stop.
|
75
|
+
rpc :DetachSubscription, DetachSubscriptionRequest, DetachSubscriptionResponse
|
71
76
|
end
|
72
77
|
|
73
78
|
Stub = Service.rpc_stub_class
|
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.
|
4
|
+
version: 1.7.1
|
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-
|
12
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -141,14 +141,14 @@ dependencies:
|
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '5.
|
144
|
+
version: '5.14'
|
145
145
|
type: :development
|
146
146
|
prerelease: false
|
147
147
|
version_requirements: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: '5.
|
151
|
+
version: '5.14'
|
152
152
|
- !ruby/object:Gem::Dependency
|
153
153
|
name: minitest-autotest
|
154
154
|
requirement: !ruby/object:Gem::Requirement
|
@@ -278,6 +278,7 @@ files:
|
|
278
278
|
- lib/google/cloud/pubsub/project.rb
|
279
279
|
- lib/google/cloud/pubsub/publish_result.rb
|
280
280
|
- lib/google/cloud/pubsub/received_message.rb
|
281
|
+
- lib/google/cloud/pubsub/retry_policy.rb
|
281
282
|
- lib/google/cloud/pubsub/service.rb
|
282
283
|
- lib/google/cloud/pubsub/snapshot.rb
|
283
284
|
- lib/google/cloud/pubsub/snapshot/list.rb
|