Google Cloud Pub/Sub is a publish/subscribe service, which is an asynchronous real-time messaging service. It sends and receives messages between different applications. The publisher application sends messages to a topic, then the subscriber applications can subscribe to that topic to receive the messages. Google Cloud Pub/Sub decouples the senders and receivers, and also store messages.
Using Google Cloud Pub/Sub with IBM® App Connect
You can use App Connect to perform actions on the following objects:
To use App Connect to integrate Google Cloud Pub/Sub with your other applications, you need to connect App Connect to your Google Cloud Pub/Sub account by providing the following information:
For more information about other supported connectors, see Connectors.
- Client email: You can get the client email from the private key JSON file that you download when you create a project in the Google Cloud Console.
- Private key: You can download the private key for your account as a JSON file when you create a project in the Google Cloud console.
- Project ID: You can find the project ID for your account in the Google Cloud Console.
Scenario: Retrieve documents from IBM Cloudant® and publish them in Google Cloud Pub/Sub topics
As an example, consider this scenario where you use App Connect to create a flow for an API that, when called, retrieves the flight times from an IBM Cloudant database and publishes them in Google Cloud Pub/Sub topics.
In this scenario, the Request node retrieves the flight times from Cloudant through the Retrieve documents action. You need to use a For each node from the Toolbox to process each document so that you can configure the flow to retrieve all the flight times.
If the retrieved flight time (in the format YYYY-MM-DDT00:00:00.000Z) is later than the time that you’ve specified, the status of the flight is retrieved. According to the status of the flight (cancelled, delayed, or on time), a message is created in the corresponding Google Cloud Pub/Sub topic.
Note: If the flight time is earlier than the time that you’ve specified, the flow stops.
The Response node contains an example of the output mapping of the documents.
Figure 1: Flow for an API to retrieve documents from Cloudant and create a message in a Google Cloud Pub/Sub topic.