Google Cloud Pub/Sub
Google Cloud Pub/Sub REST client — publish to topics, pull from subscriptions and manage IAM bindings from Delphi.
Google Cloud Pub/Sub REST client — publish to topics, pull from subscriptions and manage IAM bindings from Delphi.
Pub/Sub brings the flexibility and reliability of enterprise message-oriented middleware to the cloud. At the same time, Pub/Sub is a scalable, durable event ingestion and delivery system that serves as a foundation for modern stream analytics pipelines. By providing many-to-many, asynchronous messaging that decouples senders and receivers, it allows for secure and highly available communication among independently written applications. Pub/Sub delivers low-latency, durable messaging that helps developers quickly integrate systems hosted on the Google Cloud Platform and externally.
TsgcHTTPGoogleCloud_PubSub_Client| Standards & specs | Google Cloud Pub/Sub overview · Pub/Sub REST API reference |
| Component class | TsgcHTTPGoogleCloud_PubSub_Client (unit sgcHTTP_GoogleCloud_PubSub_Client) |
| Frameworks | VCL, FireMonkey, Lazarus / FPC |
| Platforms | Windows, macOS, Linux, iOS, Android |
The principal published / public properties used to configure and drive the component. Consult the online help for the full list.
TLSOptions | Published or public property used to configure or query the component. |
OnAuthToken | Published or public property used to configure or query the component. |
OnAuthTokenError | Published or public property used to configure or query the component. |
GoogleCloudOptions | Published or public property used to configure or query the component. |
LogFile | Published or public property used to configure or query the component. |
Version | Published or public property used to configure or query the component. |
The principal public methods exposed by the component.
DeleteSnapshot() | Public function exposed by the component. |
DeleteSubscripton() | Public function exposed by the component. |
PatchSubscription() | Public function exposed by the component. |
DeleteTopic() | Public function exposed by the component. |
Publish() | Public function exposed by the component. |
PatchTopic() | Public function exposed by the component. |
ListSnapshots() | Public function exposed by the component. |
ListSubscriptions() | Public function exposed by the component. |
ModifyAckDeadlineSubscription() | Public function exposed by the component. |
ModifyPushConfigSubscription() | Public function exposed by the component. |
Drop the component on a form, configure the properties below and activate it. The snippet that follows shows the typical Publish a message configuration sourced from the online help.
oPubSub := TsgcHTTPGoogleCloud_PubSub_Client.Create(nil); oPubSub.GoogleCloudOptions.OAuth2.ClientId := '... your google client id...'; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret := '... your google client secret...'; oPubSub.Publish('pubsub-270909', 'topic-1', 'My First Message from sgcWebSockets.'));
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub->GoogleCloudOptions->OAuth2->ClientId = "... your google client id..."; oPubSub->GoogleCloudOptions->OAuth2->ClientSecret = "... your google client secret..."; oPubSub->Publish("pubsub-270909", "topic-1", "My First Message from sgcWebSockets."));
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub.GoogleCloudOptions.OAuth2.ClientId = "... your google client id..."; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret = "... your google client secret..."; oPubSub.Publish("pubsub-270909", "topic-1", "My First Message from sgcWebSockets."));
The following scenarios are lifted verbatim from the online help. Each shows the configuration and method calls needed to drive the component through a specific real-world flow.
Google Pub/Sub component client can login to Google Servers using the following methods:
oPubSub := TsgcHTTPGoogleCloud_PubSub_Client.Create(nil); oPubSub.TLSOptions.IOHandler := iohOpenSSL; oPubSub.TLSOptions.Version := tls1_3; oPubSub.TLSOptions.VerifyCertificate := True; oPubSub.TLSOptions.OpenSSL_Options.LibPath := oslpDefaultFolder;
TsgcHTTPGoogleCloud_PubSub_Client *oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(NULL); oPubSub->TLSOptions->IOHandler = iohOpenSSL; oPubSub->TLSOptions->Version = tls1_3; oPubSub->TLSOptions->VerifyCertificate = true; oPubSub->TLSOptions->OpenSSL_Options->LibPath = oslpDefaultFolder;
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub.TLSOptions.IOHandler = TwsTLSIOHandler.iohOpenSSL; oPubSub.TLSOptions.Version = TwsTLSVersions.tls1_3; oPubSub.TLSOptions.VerifyCertificate = true; oPubSub.TLSOptions.OpenSSL_Options.LibPath = oslpDefaultFolder;
Create a new subscription for project with id: pubsub-270909, with subscription name subscription-1 and topic-1
oPubSub := TsgcHTTPGoogleCloud_PubSub_Client.Create(nil); oPubSub.GoogleCloudOptions.OAuth2.ClientId := '... your google client id...'; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret := '... your google client secret...'; oPubSub.CreateSubscription('pubsub-270909', 'subscription-1', 'topic-1');
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub->GoogleCloudOptions->OAuth2->ClientId = "... your google client id..."; oPubSub->GoogleCloudOptions->OAuth2->ClientSecret = "... your google client secret..."; oPubSub->CreateSubscription("pubsub-270909", "subscription-1", "topic-1");
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub.GoogleCloudOptions.OAuth2.ClientId = "... your google client id..."; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret = "... your google client secret..."; oPubSub.CreateSubscription("pubsub-270909", "subscription-1", "topic-1");
Read messages from previous subscription created.
oPubSub := TsgcHTTPGoogleCloud_PubSub_Client.Create(nil); oPubSub.GoogleCloudOptions.OAuth2.ClientId := '... your google client id...'; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret := '... your google client secret...'; oPubSub.pubsub.Pull('pubsub-270909', 'subscription-1');
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub->GoogleCloudOptions->OAuth2->ClientId = "... your google client id..."; oPubSub->GoogleCloudOptions->OAuth2->ClientSecret = "... your google client secret..."; oPubSub->pubsub->Pull("pubsub-270909", "subscription-1");
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub.GoogleCloudOptions.OAuth2.ClientId = "... your google client id..."; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret = "... your google client secret..."; oPubSub.pubsub.Pull("pubsub-270909", "subscription-1");
Create a new topic for project with id: pubsub-270909 and topic name topic-1.
oPubSub := TsgcHTTPGoogleCloud_PubSub_Client.Create(nil); oPubSub.GoogleCloudOptions.OAuth2.ClientId := '... your google client id...'; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret := '... your google client secret...'; oPubSub.CreateTopic('pubsub-270909', 'topic-1');
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub->GoogleCloudOptions->OAuth2->ClientId = "... your google client id..."; oPubSub->GoogleCloudOptions->OAuth2->ClientSecret = "... your google client secret..."; oPubSub->CreateTopic("pubsub-270909", "topic-1");
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub.GoogleCloudOptions.OAuth2.ClientId = "... your google client id..."; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret = "... your google client secret..."; oPubSub.CreateTopic("pubsub-270909", "topic-1");
Pub/Sub brings the flexibility and reliability of enterprise message-oriented middleware to the cloud. At the same time, Pub/Sub is a scalable, durable event ingestion and delivery system that serves as a foundation for modern stream analytics pipelines. By providing many-to-many, asynchronous messaging that decouples senders and receivers, it allows for secure and highly available communication among independently written applications. Pub/Sub delivers low-latency, durable messaging that helps developers quickly integrate systems hosted on the Google Cloud Platform and externally.
oPubSub := TsgcHTTPGoogleCloud_PubSub_Client.Create(nil); oPubSub.GoogleCloudOptions.OAuth2.ClientId := '... your google client id...'; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret := '... your google client secret...'; oAttributes := TStringList.Create; Try oAttributes.CommaText := 'origin=gcloud-sample,username=gcp'; oPubSub.Publish('pubsub-270909', 'topic-1', 'My First Message from sgcWebSockets.', oAttributes, 'username')); Finally oAttributes.Free; end;
TsgcHTTPGoogleCloud_PubSub_Client *oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub->GoogleCloudOptions->OAuth2->ClientId = "... your google client id..."; oPubSub->GoogleCloudOptions->OAuth2->ClientSecret = "... your google client secret..."; oAttributes = new TStringList(); try { oAttributes->CommaText = "origin=gcloud-sample,username=gcp"; oPubSub->Publish("pubsub-270909", "topic-1", "My First Message from sgcWebSockets.", oAttributes, "username")); } __finally { oAttributes->Free(); }
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub.GoogleCloudOptions.OAuth2.ClientId = "... your google client id..."; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret = "... your google client secret..."; oPubSub.Publish("pubsub-270909", "topic-1", "My First Message from sgcWebSockets.", "origin=gcloud-sample,username=gcp", "username"));
Pub/Sub brings the flexibility and reliability of enterprise message-oriented middleware to the cloud. At the same time, Pub/Sub is a scalable, durable event ingestion and delivery system that serves as a foundation for modern stream analytics pipelines. By providing many-to-many, asynchronous messaging that decouples senders and receivers, it allows for secure and highly available communication among independently written applications. Pub/Sub delivers low-latency, durable messaging that helps developers quickly integrate systems hosted on the Google Cloud Platform and externally.
oPubSub := TsgcHTTPGoogleCloud_PubSub_Client.Create(nil); oPubSub.GoogleCloudOptions.Authorization := gcaOAuth2; oPubSub.GoogleCloudOptions.OAuth2.ClientId := '... your google client id...'; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret := '... your google client secret...';
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub->GoogleCloudOptions->Authorization = gcaOAuth2; oPubSub->GoogleCloudOptions->OAuth2->ClientId = "... your google client id..."; oPubSub->GoogleCloudOptions->OAuth2->ClientSecret = "... your google client secret...";
oPubSub = new TsgcHTTPGoogleCloud_PubSub_Client(); oPubSub.GoogleCloudOptions.Authorization = gcaOAuth2; oPubSub.GoogleCloudOptions.OAuth2.ClientId = "... your google client id..."; oPubSub.GoogleCloudOptions.OAuth2.ClientSecret = "... your google client secret...";
Every external claim links back to a primary source. The online-help references decode the canonical deep-link the company maintains for this component.
Demos\20.HTTP_Protocol\03.Google\01.Google_PubSub