This page describes how to use Pub/Sub in Java applications built with
the [Spring Framework](https://spring.io/projects/spring-framework).

[Spring Cloud GCP](https://googlecloudplatform.github.io/spring-cloud-gcp/reference/html/index.html) has several modules for sending
messages to Pub/Sub topics and receiving messages from
Pub/Sub subscriptions using the Spring Framework. 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 Integration Channel Adapters for Pub/Sub** let you connect Spring Integration [Message Channels](https://docs.spring.io/spring-integration/reference/channel.html) with Pub/Sub.
- **Spring Cloud Stream Binder for Pub/Sub** lets you use Pub/Sub as messaging middleware in Spring Cloud Stream applications.

> [!NOTE]
> **Note:** The [Spring Cloud GCP](https://github.com/GoogleCloudPlatform/spring-cloud-gcp/tree/main/spring-cloud-gcp-pubsub/src) library does not provide access to [AckReplyConsumerWithResponse](https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsub/latest/com.google.cloud.pubsub.v1.AckReplyConsumerWithResponse.md.txt), which is a required module to implement the exactly-once feature using the Java client library.

## Using Spring Cloud GCP Pub/Sub Starter

Follow [Spring Framework on Google Cloud reference guide - Cloud Pub/Sub](https://googlecloudplatform.github.io/spring-cloud-gcp/reference/html/index.html#cloud-pubsub)
for further details on the Spring Cloud GCP Pub/Sub Starter and instructions on how to use it.

## Using Spring Integration channel adapters

Follow [Spring Framework on Google Cloud reference guide - Channel Adapters for Cloud Pub/Sub](https://googlecloudplatform.github.io/spring-cloud-gcp/reference/html/index.html#channel-adapters-for-cloud-pubsub)
for further details on the Spring Integration channel adapters and instructions on how to use them.

## Using Spring Cloud Stream Binder

Follow [Spring Framework on Google Cloud reference guide - Spring Cloud Stream Binder for Cloud Pub/Sub](https://googlecloudplatform.github.io/spring-cloud-gcp/reference/html/index.html#spring-cloud-stream)
for further details on the Spring Cloud Stream Binder and instructions on how to use it.