System Requirements
Apache Pulsar support for Spring 3.0.0-M1 requires the following:
-
Java 17 or above
-
Spring Boot
4.1.x, for Spring Boot applications
Spring Boot 4.1.x applications must set the pulsar.version property explicitly, since Spring Boot defaults to Pulsar 4.2.x.
See Set the Pulsar and Netty Versions in Spring Boot for how to set it.
|
The version compatibility matrix (including Spring Boot) can be found in the appendix.
Pulsar client
Apache Pulsar support for Spring requires the Pulsar 5.0.x client.
The Pulsar 5.0.x client is fully compatible with older Pulsar broker versions, so you can use it with your existing clusters.
Although the client version is 5.0.x, the Pulsar client v5 functionality has no specific support in this release.
Apache Pulsar support for Spring uses the client API in org.apache.pulsar.client.api.
|
It uses the unshaded client artifacts pulsar-client-original and pulsar-client-admin-original, along with pulsar-client-messagecrypto-bc for message encryption.
This means that the libraries of the client, such as Netty and Jackson, are regular dependencies of your application.
It can’t be used with pulsar-client-all, since this relocates the implementation classes that it uses.
Applications that use Protobuf schemas must add the com.google.protobuf:protobuf-java dependency themselves, as neither the Pulsar client nor this project brings it in.
They can use Protobuf 3 or 4.
Spring Boot applications should also set netty.version to the most recent 4.2.x release of Netty, as described in Set the Pulsar and Netty Versions in Spring Boot.
JVM options
The Pulsar client and Netty work best with the following JVM options, which also avoid warnings about restricted operations on recent Java versions. Use the options for your Java version when you run your application.
--add-opens java.base/java.nio=ALL-UNNAMED
--add-opens java.base/jdk.internal.misc=ALL-UNNAMED
--add-opens java.base/java.util.zip=ALL-UNNAMED
-Dio.netty.tryReflectionSetAccessible=true
On Java 23 and later, also add --sun-misc-unsafe-memory-access=allow.
On Java 24 and later, also add --enable-native-access=ALL-UNNAMED.
Java versions before those don’t support or need these options respectively, and an unsupported option prevents the JVM from starting.
The java.nio and jdk.internal.misc options, together with the system property, enable Netty’s optimized direct memory access, which helps to avoid OutOfMemoryError: Direct buffer memory errors.
The java.util.zip option enables the optimized checksum calculation when the native library can’t be loaded.