[Pub/Sub Lite](https://docs.cloud.google.com/pubsub/lite/docs.md.txt "Pub/Sub Lite") is
a real-time messaging service built for low cost and offers lower reliability
compared to Pub/Sub. Pub/Sub Lite offers zonal and regional
topics for storage.

The [Pub/Sub Lite Spark Connector](https://github.com/googleapis/java-pubsublite-spark)
supports Pub/Sub Lite as an input source to Apache Spark Structured Streaming in
the default micro-batch processing and experimental continuous
processing modes.

## Use Pub/Sub Lite with Managed Service for Apache Spark

### Java


The `samples` directory in the [`java-pubsublite-spark` repository on
GitHub](https://github.com/googleapis/java-pubsublite-spark) contains
a Spark example in Java that uses Pub/Sub Lite with
Managed Service for Apache Spark. To run the example, follow the
[directions in the Spark example](https://github.com/googleapis/java-pubsublite-spark/tree/master/samples).

1. To get started, clone the `java-pubsublite-spark` GitHub repository:

   ```
   git clone https://github.com/googleapis/java-pubsublite-spark
   cd java-pubsublite-spark/samples
   ```

### Python / Scala

The connector is available from the [Maven Central repository](https://search.maven.org/artifact/com.google.cloud/pubsublite-spark-sql-streaming).
You can download and provide it using the `--packages` option when using the
spark-submit command or set it using the `spark.jars.packages`
[configuration property](https://spark.apache.org/docs/latest/configuration.html#available-properties).

## What's next

- See [Using Pub/Sub Lite with Apache Spark](https://docs.cloud.google.com/pubsub/lite/docs/write-messages-apache-spark.md.txt), a quickstart that runs a Python script on a Managed Service for Apache Spark cluster to read and write data from and to Pub/Sub Lite.
- [Select the version of the Pub/Sub Lite Spark Connector](https://search.maven.org/artifact/com.google.cloud/pubsublite-spark-sql-streaming), and then download its JAR on the linked page.