google-cloud-pubsub 0.33.1 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +41 -40
- data/CHANGELOG.md +610 -0
- data/CONTRIBUTING.md +328 -116
- data/EMULATOR.md +2 -2
- data/LOGGING.md +95 -3
- data/OVERVIEW.md +183 -90
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google/cloud/pubsub/acknowledge_result.rb +79 -0
- data/lib/google/cloud/pubsub/async_publisher/batch.rb +306 -0
- data/lib/google/cloud/pubsub/async_publisher.rb +270 -161
- data/lib/google/cloud/pubsub/batch_publisher.rb +65 -33
- data/lib/google/cloud/pubsub/convert.rb +36 -8
- data/lib/google/cloud/pubsub/credentials.rb +7 -5
- data/lib/google/cloud/pubsub/errors.rb +93 -0
- data/lib/google/cloud/pubsub/flow_controller.rb +139 -0
- data/lib/google/cloud/pubsub/message.rb +52 -7
- data/lib/google/cloud/pubsub/policy.rb +15 -12
- data/lib/google/cloud/pubsub/project.rb +341 -75
- data/lib/google/cloud/pubsub/publish_result.rb +9 -2
- data/lib/google/cloud/pubsub/received_message.rb +182 -20
- 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 +285 -258
- data/lib/google/cloud/pubsub/snapshot/list.rb +14 -14
- data/lib/google/cloud/pubsub/snapshot.rb +17 -12
- data/lib/google/cloud/pubsub/subscriber/enumerator_queue.rb +4 -4
- data/lib/google/cloud/pubsub/subscriber/inventory.rb +74 -33
- data/lib/google/cloud/pubsub/subscriber/sequencer.rb +115 -0
- data/lib/google/cloud/pubsub/subscriber/stream.rb +138 -91
- data/lib/google/cloud/pubsub/subscriber/timed_unary_buffer.rb +397 -0
- data/lib/google/cloud/pubsub/subscriber.rb +213 -51
- data/lib/google/cloud/pubsub/subscription/list.rb +16 -16
- data/lib/google/cloud/pubsub/subscription/push_config.rb +268 -0
- data/lib/google/cloud/pubsub/subscription.rb +827 -137
- data/lib/google/cloud/pubsub/topic/list.rb +14 -14
- data/lib/google/cloud/pubsub/topic.rb +565 -93
- data/lib/google/cloud/pubsub/version.rb +4 -2
- data/lib/google/cloud/pubsub.rb +50 -41
- data/lib/google-cloud-pubsub.rb +26 -29
- metadata +59 -53
- data/lib/google/cloud/pubsub/subscriber/async_stream_pusher.rb +0 -222
- data/lib/google/cloud/pubsub/subscriber/async_unary_pusher.rb +0 -270
- data/lib/google/cloud/pubsub/v1/credentials.rb +0 -39
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +0 -63
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +0 -128
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +0 -230
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +0 -109
- data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +0 -628
- data/lib/google/cloud/pubsub/v1/publisher_client.rb +0 -734
- data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -105
- data/lib/google/cloud/pubsub/v1/subscriber_client.rb +0 -1267
- data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -144
- data/lib/google/cloud/pubsub/v1.rb +0 -17
- data/lib/google/pubsub/v1/pubsub_pb.rb +0 -222
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +0 -192
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6f6bca71a506686e481d68852eee2813f5b10908b824089e07bf6ad4070d10a
|
4
|
+
data.tar.gz: a52f4f7140448a02c2806ed2d7b04a36b1d62f686cb5d0a62dbfce26670165b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83662ae6574bf94c38bf19dfc46cda6f6a4fa11b465640ac35794a8ed38f2476244f5be5fb54ef82a1aac90fe4a0b890212e540f5136faaf1b480156d40b2217
|
7
|
+
data.tar.gz: fded200fa64d0f38a047fa3e2ea5bb3d3c204e8e82748b3611e796e2812809b98281865a923ca33ca2d3086d7c7ef72ca0671656813d77805f49b4b7b32f6e9b
|
data/AUTHENTICATION.md
CHANGED
@@ -2,20 +2,39 @@
|
|
2
2
|
|
3
3
|
In general, the google-cloud-pubsub library uses [Service
|
4
4
|
Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
|
5
|
-
credentials to connect to Google Cloud services. When running
|
5
|
+
credentials to connect to Google Cloud services. When running within [Google
|
6
|
+
Cloud Platform environments](#google-cloud-platform-environments)
|
6
7
|
the credentials will be discovered automatically. When running on other
|
7
8
|
environments, the Service Account credentials can be specified by providing the
|
8
9
|
path to the [JSON
|
9
10
|
keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for
|
10
|
-
the account (or the JSON itself) in environment
|
11
|
-
SDK credentials can also
|
12
|
-
recommended during development.
|
11
|
+
the account (or the JSON itself) in [environment
|
12
|
+
variables](#environment-variables). Additionally, Cloud SDK credentials can also
|
13
|
+
be discovered automatically, but this is only recommended during development.
|
14
|
+
|
15
|
+
## Quickstart
|
16
|
+
|
17
|
+
1. [Create a service account and credentials](#creating-a-service-account).
|
18
|
+
2. Set the [environment variable](#environment-variables).
|
19
|
+
|
20
|
+
```sh
|
21
|
+
export PUBSUB_CREDENTIALS=/path/to/json`
|
22
|
+
```
|
23
|
+
|
24
|
+
3. Initialize the client.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require "google/cloud/pubsub"
|
28
|
+
|
29
|
+
client = Google::Cloud::PubSub.new
|
30
|
+
```
|
13
31
|
|
14
32
|
## Project and Credential Lookup
|
15
33
|
|
16
|
-
The google-cloud-pubsub library aims to make authentication
|
17
|
-
possible, and provides several mechanisms to configure your system
|
18
|
-
providing **Project ID** and **Service Account Credentials** directly in
|
34
|
+
The google-cloud-pubsub library aims to make authentication
|
35
|
+
as simple as possible, and provides several mechanisms to configure your system
|
36
|
+
without providing **Project ID** and **Service Account Credentials** directly in
|
37
|
+
code.
|
19
38
|
|
20
39
|
**Project ID** is discovered in the following order:
|
21
40
|
|
@@ -23,6 +42,7 @@ providing **Project ID** and **Service Account Credentials** directly in code.
|
|
23
42
|
2. Specify project ID in configuration
|
24
43
|
3. Discover project ID in environment variables
|
25
44
|
4. Discover GCE project ID
|
45
|
+
5. Discover project ID in credentials JSON
|
26
46
|
|
27
47
|
**Credentials** are discovered in the following order:
|
28
48
|
|
@@ -35,32 +55,10 @@ providing **Project ID** and **Service Account Credentials** directly in code.
|
|
35
55
|
|
36
56
|
### Google Cloud Platform environments
|
37
57
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
should be written as if already authenticated.
|
42
|
-
GCE instance][gce-how-to], you add the correct scopes for the APIs you want to
|
43
|
-
access. For example:
|
44
|
-
|
45
|
-
* **All APIs**
|
46
|
-
* `https://www.googleapis.com/auth/cloud-platform`
|
47
|
-
* `https://www.googleapis.com/auth/cloud-platform.read-only`
|
48
|
-
* **BigQuery**
|
49
|
-
* `https://www.googleapis.com/auth/bigquery`
|
50
|
-
* `https://www.googleapis.com/auth/bigquery.insertdata`
|
51
|
-
* **Compute Engine**
|
52
|
-
* `https://www.googleapis.com/auth/compute`
|
53
|
-
* **Datastore**
|
54
|
-
* `https://www.googleapis.com/auth/datastore`
|
55
|
-
* `https://www.googleapis.com/auth/userinfo.email`
|
56
|
-
* **DNS**
|
57
|
-
* `https://www.googleapis.com/auth/ndev.clouddns.readwrite`
|
58
|
-
* **Pub/Sub**
|
59
|
-
* `https://www.googleapis.com/auth/pubsub`
|
60
|
-
* **Storage**
|
61
|
-
* `https://www.googleapis.com/auth/devstorage.full_control`
|
62
|
-
* `https://www.googleapis.com/auth/devstorage.read_only`
|
63
|
-
* `https://www.googleapis.com/auth/devstorage.read_write`
|
58
|
+
When running on Google Cloud Platform (GCP), including Google Compute Engine (GCE),
|
59
|
+
Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud Functions
|
60
|
+
(GCF) and Cloud Run, the **Project ID** and **Credentials** and are discovered
|
61
|
+
automatically. Code should be written as if already authenticated.
|
64
62
|
|
65
63
|
### Environment Variables
|
66
64
|
|
@@ -73,12 +71,13 @@ environment variable, or the **Credentials JSON** itself can be stored for
|
|
73
71
|
environments such as Docker containers where writing files is difficult or not
|
74
72
|
encouraged.
|
75
73
|
|
76
|
-
The environment variables that
|
74
|
+
The environment variables that google-cloud-pubsub checks for project ID are:
|
77
75
|
|
78
76
|
1. `PUBSUB_PROJECT`
|
79
77
|
2. `GOOGLE_CLOUD_PROJECT`
|
80
78
|
|
81
|
-
The environment variables that
|
79
|
+
The environment variables that google-cloud-pubsub checks for credentials
|
80
|
+
are configured on {Google::Cloud::PubSub::Credentials}:
|
82
81
|
|
83
82
|
1. `PUBSUB_CREDENTIALS` - Path to JSON file, or JSON contents
|
84
83
|
2. `PUBSUB_KEYFILE` - Path to JSON file, or JSON contents
|
@@ -92,22 +91,23 @@ require "google/cloud/pubsub"
|
|
92
91
|
ENV["PUBSUB_PROJECT"] = "my-project-id"
|
93
92
|
ENV["PUBSUB_CREDENTIALS"] = "path/to/keyfile.json"
|
94
93
|
|
95
|
-
|
94
|
+
client = Google::Cloud::PubSub.new
|
96
95
|
```
|
97
96
|
|
98
97
|
### Configuration
|
99
98
|
|
100
|
-
The **Project ID** and **Credentials JSON** can be configured
|
99
|
+
The **Project ID** and the path to the **Credentials JSON** file can be configured
|
100
|
+
instead of placing them in environment variables or providing them as arguments.
|
101
101
|
|
102
102
|
```ruby
|
103
103
|
require "google/cloud/pubsub"
|
104
104
|
|
105
|
-
Google::Cloud::
|
105
|
+
Google::Cloud::PubSub.configure do |config|
|
106
106
|
config.project_id = "my-project-id"
|
107
107
|
config.credentials = "path/to/keyfile.json"
|
108
108
|
end
|
109
109
|
|
110
|
-
|
110
|
+
client = Google::Cloud::PubSub.new
|
111
111
|
```
|
112
112
|
|
113
113
|
### Cloud SDK
|
@@ -140,7 +140,8 @@ Google Cloud requires a **Project ID** and **Service Account Credentials** to
|
|
140
140
|
connect to the APIs. You will use the **Project ID** and **JSON key file** to
|
141
141
|
connect to most services with google-cloud-pubsub.
|
142
142
|
|
143
|
-
If you are not running this client
|
143
|
+
If you are not running this client within [Google Cloud Platform
|
144
|
+
environments](#google-cloud-platform-environments), you need a Google
|
144
145
|
Developers service account.
|
145
146
|
|
146
147
|
1. Visit the [Google Developers Console][dev-console].
|