Integrate with serverless Google Cloud Pub/Sub for messaging.
import apache_beam as beam
# 1. Read from Pub/Sub topic/subscription
messages = p | "ReadPubSub" >> beam.io.ReadFromPubSub(
subscription="projects/my-project/subscriptions/my-sub"
)
# 2. Write to Pub/Sub topic
messages | "WritePubSub" >> beam.io.WriteToPubSub(
topic="projects/my-project/topics/my-topic"
)