简体   繁体   English

Spring 和 Google Cloud PubSub - 订阅事件

[英]Spring and Google Cloud PubSub - subscribing to events

Following documentation , there are multiple ways to integrate Google Cloud PubSub events with Spring application:按照文档,有多种方法可以将 Google Cloud PubSub 事件与 Spring 应用程序集成:

Spring Cloud GCP has several modules for sending messages to Pub/Sub topics and receiving messages from Pub/Sub subscriptions using the Spring Framework. Spring Cloud GCP 有几个模块,用于使用 Spring 框架向 Pub/Sub 主题发送消息以及从 Pub/Sub 订阅接收消息。 You can use these modules independently or combine them for different use cases:您可以独立使用这些模块或将它们组合用于不同的用例:

  • Spring Cloud GCP Pub/Sub Starter lets you send and receive messages using helper classes and call the Pub/Sub Java client library for more advanced scenarios. Spring Cloud GCP Pub/Sub Starter 让您可以使用帮助类发送和接收消息,并调用 Pub/Sub Java 客户端库以实现更高级的场景。
  • Spring Integration Channel Adapters for Pub/Sub let you connect Spring Integration Message Channels with Pub/Sub. Spring Pub/Sub 集成通道适配器让您可以将 Spring 集成消息通道与 Pub/Sub 连接起来。
  • Spring Cloud Stream Binder for Pub/Sub lets you use Pub/Sub as messaging middleware in Spring Cloud Stream applications. Spring Cloud Stream Pub/Sub 绑定器让您可以在 Spring Cloud Stream 应用程序中使用 Pub/Sub 作为消息传递中间件。

I don't have full understanding - what are those different use cases mentioned, and how to determine, which module is best for which use case?我没有完全理解 - 提到了哪些不同的用例,以及如何确定哪个模块最适合哪个用例?

Application (Dockerized Spring Boot app, deployed to Kube.netes in GCP) I am working on is rather simple, it is expected to act upon received PubSub event, it is not going to publish any events itself.应用程序(Dockerized Spring Boot app,部署到 GCP 中的 Kube.netes)我正在处理的是相当简单的,它应该根据收到的 PubSub 事件采取行动,它本身不会发布任何事件。

Spring Cloud GCP Pub/Sub Starter module contains the java client classes for pub sub which will be used by your spring application to perform administrative and functional operations (ie. sending and receiving messages). Spring Cloud GCP Pub/Sub Starter模块包含 pub sub 的 java 客户端类,您的 spring 应用程序将使用它来执行管理和功能操作(即发送和接收消息)。

Spring Integration Channel Adapters for Pub/Sub module is utilized when your spring application uses Message Channels .当您的 spring 应用程序使用Message Channels时,将使用Spring Integration Channel Adapters for Pub/Sub模块。 This module will help routing message between message channel and pub/sub using channel adapters .该模块将帮助使用通道适配器在消息通道和发布/订阅之间路由消息。

Spring Cloud Stream Binder for Pub/Sub module is used in Spring Cloud Stream Applications in order to utilize cloud Pub/Sub API. Spring Cloud Stream Binder for Pub/Sub模块的绑定器用于 Spring 云 Stream应用程序以利用云发布/订阅 API。

Since, your application requirements are basic you can easily go for Spring Cloud GCP Pub/Sub Starter module.因为,您的应用程序要求是基本的,您可以轻松地 go Spring Cloud GCP Pub/Sub Starter 模块。 For more information you can refer to this Google documentation .有关详细信息,您可以参考此 Google 文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 订阅 Google 云发布/订阅的 kubernetes pod 的多个副本 - Multiple replicas of a kubernetes pods subscribing to a Google cloud pub/sub SubscriberAdminClient.pull 与 Google Cloud PubSub 的订阅者 - SubscriberAdminClient.pull vs. Subscriber for Google Cloud PubSub 使用 Golang 读取 Google Cloud Pubsub 消息并写入 BigQuery - Read Google Cloud Pubsub message and write to BigQuery using Golang TypeScript 种类型,带有 Google Cloud Functions 和 Cloud Events - TypeScript types with Google Cloud Functions and Cloud Events Google Cloud Spanner 通过 Cloud Data Fusion 或其他方式实时更改数据捕获到 PubSub/Kafka - Google Cloud Spanner real time Change Data Capture to PubSub/Kafka through Cloud Data Fusion or Others 如何将数据从 Google PubSub 主题流式传输到 PySpark(在 Google Cloud 上) - How can I stream data from a Google PubSub topic into PySpark (on Google Cloud) 使用 google pubsub 模拟器和 Spring function.adapter.gcp.GcfJarLauncher 时出错 - Error when use google pubsub emulator and Spring function.adapter.gcp.GcfJarLauncher 尝试解析从 Google Cloud PubSub 检索到的协议缓冲区架构时出现“错误:非法令牌‘字符串’” - "Error: Illegal token 'string'" when trying to parse protocol buffer schema retrieved from Google Cloud PubSub Google PubSub 到 Kafka 源连接器 - Google PubSub to Kafka Source connector 通过 configMap 将参数传递给 GKE google cloud 中的 Spring boot 应用程序 - Passing params via configMap to Spring boot application in GKE google cloud
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM