如何在 Google Cloud App Engine 上使用 PubSub 创建订阅者,通过 Publisher 从 Google Cloud App Engine Flex 收听消息?

How to create a subscriber with PubSub on Google Cloud App Engine that listens to a message via Publisher from a Google Cloud App Engine Flex?

我在 Google App Engine 上有一个 Django 应用程序 运行。 Google App Engine Flex 中还有另一个耗时的应用程序 运行,它是从 Google App Engine 应用程序触发的。

当 Google App Engine Flex 应用程序完成执行时,我希望它触发一条消息并将其发送到 Google App Engine Django 应用程序,以便 Django 可以相应地更新数据库项。

如何使用 Google Cloud PubSub 实现此目的?

1.Create a pubsub topic

2.App Engine Flex 应用程序将publish messages 到您创建的主题

3.Google App Engine Django 应用程序将收到此消息 (receiving messages using pull subscriptions or receiving messages using push subscriptions