google-cloud-pubsub 0.26.0 → 0.27.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/lib/google/cloud/pubsub.rb +67 -31
- data/lib/google/cloud/pubsub/async_publisher.rb +328 -0
- data/lib/google/cloud/pubsub/batch_publisher.rb +98 -0
- data/lib/google/cloud/pubsub/convert.rb +63 -0
- data/lib/google/cloud/pubsub/message.rb +13 -4
- data/lib/google/cloud/pubsub/project.rb +64 -184
- data/lib/google/cloud/pubsub/publish_result.rb +96 -0
- data/lib/google/cloud/pubsub/received_message.rb +36 -2
- data/lib/google/cloud/pubsub/service.rb +25 -28
- data/lib/google/cloud/pubsub/subscriber.rb +185 -0
- data/lib/google/cloud/pubsub/subscriber/async_pusher.rb +220 -0
- data/lib/google/cloud/pubsub/subscriber/enumerator_queue.rb +52 -0
- data/lib/google/cloud/pubsub/subscriber/stream.rb +376 -0
- data/lib/google/cloud/pubsub/subscription.rb +102 -72
- data/lib/google/cloud/pubsub/topic.rb +125 -32
- data/lib/google/cloud/pubsub/v1/publisher_client_config.json +1 -1
- data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +10 -1
- data/lib/google/cloud/pubsub/version.rb +1 -1
- metadata +38 -3
- data/lib/google/cloud/pubsub/topic/publisher.rb +0 -86
@@ -33,6 +33,15 @@
|
|
33
33
|
"rpc_timeout_multiplier": 1.0,
|
34
34
|
"max_rpc_timeout_millis": 12000,
|
35
35
|
"total_timeout_millis": 600000
|
36
|
+
},
|
37
|
+
"streaming_messaging": {
|
38
|
+
"initial_retry_delay_millis": 100,
|
39
|
+
"retry_delay_multiplier": 1.3,
|
40
|
+
"max_retry_delay_millis": 60000,
|
41
|
+
"initial_rpc_timeout_millis": 600000,
|
42
|
+
"rpc_timeout_multiplier": 1.0,
|
43
|
+
"max_rpc_timeout_millis": 600000,
|
44
|
+
"total_timeout_millis": 600000
|
36
45
|
}
|
37
46
|
},
|
38
47
|
"methods": {
|
@@ -79,7 +88,7 @@
|
|
79
88
|
"StreamingPull": {
|
80
89
|
"timeout_millis": 60000,
|
81
90
|
"retry_codes_name": "pull",
|
82
|
-
"retry_params_name": "
|
91
|
+
"retry_params_name": "streaming_messaging"
|
83
92
|
},
|
84
93
|
"ModifyPushConfig": {
|
85
94
|
"timeout_millis": 60000,
|
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: 0.
|
4
|
+
version: 0.27.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: 2017-
|
12
|
+
date: 2017-08-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -53,6 +53,34 @@ dependencies:
|
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.6.8
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: grpc
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.1'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.1'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: concurrent-ruby
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.0'
|
56
84
|
- !ruby/object:Gem::Dependency
|
57
85
|
name: minitest
|
58
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,19 +220,26 @@ files:
|
|
192
220
|
- README.md
|
193
221
|
- lib/google-cloud-pubsub.rb
|
194
222
|
- lib/google/cloud/pubsub.rb
|
223
|
+
- lib/google/cloud/pubsub/async_publisher.rb
|
224
|
+
- lib/google/cloud/pubsub/batch_publisher.rb
|
225
|
+
- lib/google/cloud/pubsub/convert.rb
|
195
226
|
- lib/google/cloud/pubsub/credentials.rb
|
196
227
|
- lib/google/cloud/pubsub/message.rb
|
197
228
|
- lib/google/cloud/pubsub/policy.rb
|
198
229
|
- lib/google/cloud/pubsub/project.rb
|
230
|
+
- lib/google/cloud/pubsub/publish_result.rb
|
199
231
|
- lib/google/cloud/pubsub/received_message.rb
|
200
232
|
- lib/google/cloud/pubsub/service.rb
|
201
233
|
- lib/google/cloud/pubsub/snapshot.rb
|
202
234
|
- lib/google/cloud/pubsub/snapshot/list.rb
|
235
|
+
- lib/google/cloud/pubsub/subscriber.rb
|
236
|
+
- lib/google/cloud/pubsub/subscriber/async_pusher.rb
|
237
|
+
- lib/google/cloud/pubsub/subscriber/enumerator_queue.rb
|
238
|
+
- lib/google/cloud/pubsub/subscriber/stream.rb
|
203
239
|
- lib/google/cloud/pubsub/subscription.rb
|
204
240
|
- lib/google/cloud/pubsub/subscription/list.rb
|
205
241
|
- lib/google/cloud/pubsub/topic.rb
|
206
242
|
- lib/google/cloud/pubsub/topic/list.rb
|
207
|
-
- lib/google/cloud/pubsub/topic/publisher.rb
|
208
243
|
- lib/google/cloud/pubsub/v1.rb
|
209
244
|
- lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb
|
210
245
|
- lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# Copyright 2015 Google Inc. All rights reserved.
|
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
|
-
# http://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
|
-
class Topic
|
20
|
-
##
|
21
|
-
# Topic Publisher object used to publish multiple messages at once.
|
22
|
-
#
|
23
|
-
# @example
|
24
|
-
# require "google/cloud/pubsub"
|
25
|
-
#
|
26
|
-
# pubsub = Google::Cloud::Pubsub.new
|
27
|
-
#
|
28
|
-
# topic = pubsub.topic "my-topic"
|
29
|
-
# msgs = topic.publish do |t|
|
30
|
-
# t.publish "task 1 completed", foo: :bar
|
31
|
-
# t.publish "task 2 completed", foo: :baz
|
32
|
-
# t.publish "task 3 completed", foo: :bif
|
33
|
-
# end
|
34
|
-
class Publisher
|
35
|
-
##
|
36
|
-
# @private The messages to publish
|
37
|
-
attr_reader :messages
|
38
|
-
|
39
|
-
##
|
40
|
-
# @private Create a new instance of the object.
|
41
|
-
def initialize data = nil, attributes = {}
|
42
|
-
@messages = []
|
43
|
-
@mode = :batch
|
44
|
-
return if data.nil?
|
45
|
-
@mode = :single
|
46
|
-
publish data, attributes
|
47
|
-
end
|
48
|
-
|
49
|
-
##
|
50
|
-
# Add multiple messages to the topic.
|
51
|
-
# All messages added will be published at once.
|
52
|
-
# See {Google::Cloud::Pubsub::Topic#publish}
|
53
|
-
def publish data, attributes = {}
|
54
|
-
# Convert IO-ish objects to strings
|
55
|
-
if data.respond_to?(:read) && data.respond_to?(:rewind)
|
56
|
-
data.rewind
|
57
|
-
data = data.read
|
58
|
-
end
|
59
|
-
# Convert data to encoded byte array to match the protobuf defn
|
60
|
-
data = String(data).force_encoding("ASCII-8BIT")
|
61
|
-
# Convert attributes to strings to match the protobuf definition
|
62
|
-
attributes = Hash[attributes.map { |k, v| [String(k), String(v)] }]
|
63
|
-
@messages << [data, attributes]
|
64
|
-
end
|
65
|
-
|
66
|
-
##
|
67
|
-
# @private Create Message objects with message ids.
|
68
|
-
def to_gcloud_messages message_ids
|
69
|
-
msgs = @messages.zip(Array(message_ids)).map do |arr, id|
|
70
|
-
Message.from_grpc(
|
71
|
-
Google::Pubsub::V1::PubsubMessage.new(
|
72
|
-
data: arr[0], attributes: arr[1], message_id: id))
|
73
|
-
end
|
74
|
-
# Return just one Message if a single publish,
|
75
|
-
# otherwise return the array of Messages.
|
76
|
-
if @mode == :single && msgs.count <= 1
|
77
|
-
msgs.first
|
78
|
-
else
|
79
|
-
msgs
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|