Apache Pulsar support for Spring

Clone this repo:

Branches

  1. 999ca7c build: upgrade dependencies to Spring Boot 4.1.2 versions by Lari Hotari · 4 hours ago main
  2. 1f1eab1 build: remove unused buildSrc dependencies by Lari Hotari · 17 hours ago
  3. a2b20dc build: upgrade Gradle plugins by Lari Hotari · 17 hours ago
  4. 2b93e96 build: remove unused plugins by Lari Hotari · 17 hours ago
  5. 50e450d build: upgrade Kotlin, protobuf and Node plugins for Gradle compatibility by Lari Hotari · 18 hours ago

Apache Pulsar support for Spring

Apache Pulsar support for Spring makes it easier to build Apache Pulsar applications with Spring. It provides PulsarTemplate for publishing messages, @PulsarListener and @PulsarReader for consuming them, Spring Boot auto-configuration and a Spring Cloud Stream binder.

Documentation

The reference documentation will be available at https://pulsar.apache.org/pulsar-spring/reference.

Until it's published, you can build it locally with the command in Building.

Background

This project is the successor to Spring for Apache Pulsar. It brings together code that was previously maintained in three repositories:

Previous repositoryCode
spring-projects/spring-pulsarCore library, cache providers and test utilities
spring-projects/spring-bootSpring Boot auto-configuration and starters
spring-cloud/spring-cloud-streamSpring Cloud Stream binder

The version has been bumped to 3.0.0-M1 to indicate that it's the successor to Spring for Apache Pulsar 2.0.x. Further development happens under the Apache Pulsar project in this repository.

The Maven coordinates and Java packages have changed. See Migration from Spring's Pulsar support for the changes to make in your application.

Modules

All artifacts use the org.apache.pulsar group ID.

ArtifactDescription
pulsar-springCore library
pulsar-spring-boot-autoconfigureSpring Boot auto-configuration
pulsar-spring-boot-starterStarter for Spring Boot applications
pulsar-spring-boot-starter-testStarter for testing Spring Boot applications
pulsar-spring-cloud-stream-binderSpring Cloud Stream binder
pulsar-spring-cache-providerCache provider API
pulsar-spring-cache-provider-caffeineCaffeine cache provider
pulsar-spring-testTest utilities
pulsar-spring-bomBill of materials

Sample applications are in pulsar-spring-sample-apps.

Building

The build uses the included Gradle wrapper and a Java 25 toolchain. Docker is required for the tests.

# Full build, including tests
./gradlew build

# Also run the sample application tests
./gradlew build -PsampleTests

# Reference documentation, generated in pulsar-spring-docs/build/site
./gradlew :pulsar-spring-docs:antora

Publishing

Artifacts are published to the Apache repository. publishArtifacts uses the snapshot repository for -SNAPSHOT versions and a staging repository for other versions, which must be signed. It refuses to publish a version to the wrong repository.

Pass your ASF credentials as environment variables so that they aren't stored in gradle.properties, and start the command with a space to keep the password out of your shell history:

# Snapshot
 ORG_GRADLE_PROJECT_apacheSnapshotsUsername=<ASF ID> \
 ORG_GRADLE_PROJECT_apacheSnapshotsPassword=<password> \
 ./gradlew publishArtifacts

# Release or milestone, with -Psigning.gnupg.keyName=<key ID> to choose a key other than the default
 ORG_GRADLE_PROJECT_apacheReleasesUsername=<ASF ID> \
 ORG_GRADLE_PROJECT_apacheReleasesPassword=<password> \
 ./gradlew publishArtifacts -PuseGpgCmd=true

Set -PapacheSnapshotsRepoUrl and -PapacheReleasesRepoUrl to file:// URLs to test the publication without uploading anything.

Source release

sourceRelease creates the source release for an ASF release vote in build/source-release: an archive of the committed tree, with a SHA-512 checksum and a detached signature.

./gradlew sourceRelease -PuseGpgCmd=true

For a non-snapshot version, it fails if there are uncommitted changes, if the committed gradle.properties has a different version, or if signing isn't configured. The reference documentation is skipped when building from the archive because Antora needs a git repository, so build the site from a clone.

Security

Don't report vulnerabilities in public issues. See SECURITY.md for how to report them.

License

Licensed under the Apache License, Version 2.0.