Data Pipelines on GCP: Pub/Sub, Dataflow, Dataproc, Cloud Composer, Data Fusion and Choosing the Right Tool

Google Cloud Platform Architect 60 min min read Updated: Nov 17, 2026 Intermediate
Data Pipelines on GCP: Pub/Sub, Dataflow, Dataproc, Cloud Composer, Data Fusion and Choosing the Right Tool
Intermediate Topic 2 of 3

Batch and Streaming

BatchStreaming
DataCollected and processed in chunks (hourly, nightly)Processed event by event as it arrives
LatencyMinutes to hoursSeconds
ExampleNightly sales reportFraud alert on a card swipe

Pub/Sub: Messaging

  • A global, serverless messaging service that decouples producers and consumers
  • Topic receives messages. Subscriptions deliver them. Each subscription gets its own copy (fan-out)
  • Pull (the app asks), push (Pub/Sub calls an HTTPS endpoint), BigQuery and Cloud Storage subscriptions (write directly, no code)
  • At-least-once delivery by default, optional exactly-once and ordering keys, dead-letter topics, message retention up to 31 days with replay
  • Scales to millions of messages per second
bash gcloud pubsub topics create orders gcloud pubsub subscriptions create orders-bq --topic=orders --bigquery-table=my-proj:sales.orders_stream --use-table-schema gcloud pubsub subscriptions create orders-worker --topic=orders --ack-deadline=30 --dead-letter-topic=orders-dlq --max-delivery-attempts=5 gcloud pubsub topics publish orders --message='{"orderId": 42, "amount": 499}' gcloud pubsub subscriptions pull orders-worker --auto-ack --limit=5

Dataflow

  • Fully managed service for Apache Beam pipelines, for batch and streaming with the same code
  • Autoscaling, exactly-once processing, windowing and watermarks for late data
  • Ready templates (for example Pub/Sub to BigQuery, Cloud Storage text to BigQuery) need no code
bash gcloud dataflow jobs run orders-to-bq --gcs-location=gs://dataflow-templates-asia-south1/latest/PubSub_Subscription_to_BigQuery \ --region=asia-south1 --parameters=inputSubscription=projects/my-proj/subscriptions/orders-worker,outputTableSpec=my-proj:sales.orders_stream
python import apache_beam as beam with beam.Pipeline() as p: (p | "Read" >> beam.io.ReadFromText("gs://acme-reports-482/words.txt") | "Split" >> beam.FlatMap(lambda line: line.split()) | "Pair" >> beam.Map(lambda w: (w, 1)) | "Count" >> beam.CombinePerKey(sum) | "Write" >> beam.io.WriteToText("gs://acme-reports-482/out/counts"))

Dataproc

  • Managed Spark, Hadoop, Hive, Flink clusters that start in about 90 seconds
  • Best to migrate existing Hadoop/Spark jobs with few changes
  • Use ephemeral clusters (create, run job, delete) and preemptible/Spot workers to save money, or Dataproc Serverless for no cluster
bash gcloud dataproc clusters create etl --region=asia-south1 --num-workers=2 --image-version=2.2-debian12 gcloud dataproc jobs submit pyspark gs://acme-code/job.py --cluster=etl --region=asia-south1 gcloud dataproc clusters delete etl --region=asia-south1 --quiet

Orchestration: Cloud Composer

  • Managed Apache Airflow to schedule and chain tasks as DAGs (what runs first, retries, alerts)
  • Use it when a pipeline has many steps across services (load, transform, check, notify)
  • Lighter options: Workflows, Cloud Scheduler, Cloud Run jobs
python from airflow import DAG from airflow.providers.google.cloud.operators.bigquery import BigQueryInsertJobOperator from datetime import datetime with DAG("daily_sales", start_date=datetime(2026, 11, 1), schedule="0 2 * * *", catchup=False) as dag: BigQueryInsertJobOperator(task_id="build_summary", configuration={"query": {"query": "CALL sales.build_daily_summary()", "useLegacySql": False}})

Other Tools

ToolWhat it is
Cloud Data FusionVisual, drag-and-drop ETL (based on CDAP)
DatastreamServerless change data capture from MySQL, PostgreSQL, Oracle into BigQuery or Cloud Storage
Dataform / BigQuery pipelinesSQL-based transformations in BigQuery (ELT)
DataplexData governance, quality, lineage and catalog across lakes and warehouses
Looker / Looker StudioBI and dashboards

Reference Architecture: Streaming Analytics

text Apps / IoT ─► Pub/Sub ─► Dataflow (clean, window, enrich) ─► BigQuery ─► Looker dashboards └─► raw copy to Cloud Storage (data lake) Cloud Composer schedules nightly Dataproc or BigQuery jobs; Dataplex governs data

Choosing

NeedChoose
Ingest and fan out eventsPub/Sub
Stream or batch transform with managed scalingDataflow
Run existing Spark/Hadoop codeDataproc
Schedule many dependent tasksCloud Composer or Workflows
No-code ETLData Fusion
Replicate database changesDatastream
SQL transformations inside the warehouseBigQuery / Dataform

Practice

  1. Create a topic with a BigQuery subscription and publish three messages
  2. Run a Dataflow template from Pub/Sub to BigQuery
  3. Describe a nightly batch pipeline and a streaming pipeline for the same shop
  4. Pick tools for a company with many Spark jobs on-premises

Conclusion

Pub/Sub ingests events, Dataflow processes batch and streaming, Dataproc runs Spark and Hadoop, Composer orchestrates and BigQuery stores analytics. Choose by whether you are moving existing code, building new pipelines or scheduling.

Quick Summary: batch vs streaming; Pub/Sub; Dataflow; Dataproc; Composer; other; architecture; choosing.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators