Google Cloud Pub/Sub Delphi 组件

· 组件

从 sgcWebSockets 4.3.6 起,支持 Google Cloud Pub/Sub API。

Pub/Sub 为云端带来了企业级消息中间件的灵活性与可靠性。同时,Pub/Sub 是一个可扩展、持久化的事件摄取和交付系统,是现代流式分析管道的基础。通过提供多对多、异步消息传递来解耦发送方和接收方,它实现了独立开发的应用程序之间安全且高可用的通信。Pub/Sub 提供低延迟、持久化的消息传递,帮助开发者快速集成托管在 Google Cloud Platform 上及外部的系统。

常见使用场景


Delphi / C++Builder 组件

sgcWebSockets Google Cloud Pub/Sub 组件使用 REST API 连接到 Google API。以下是创建新主题的示例。

//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');
//Response from Server
{
  "name": "projects/pubsub-270909/topics/topic-1"
}

Google Cloud Pub/Sub 文档

阅读更多关于客户端组件的说明,并查看更多使用示例。 https://www.esegece.com/help/sgcWebSockets/#t=Components%2FHTTP%2FGoogle%2FGoogle_Cloud_Pub_Sub.htm