Skip to main content

Pulsar Java client

You can use a Pulsar Java client to create Pulsar producers, consumers, and readers in Java and perform administrative tasks. All the methods in Java clients are thread-safe. The current Java client version is 3.0.7.

Get started

  1. Set up Java client library
  2. Initialize a Java client
  3. Use a Java client
note

Please refer to Java client Performance considerations for more information on how to improve the performance of the Java client and tune the Java JVM options to avoid java.lang.OutOfMemoryError: Direct buffer memory errors in high-throughput applications.

What's next?

Reference doc

API reference

The following table outlines the API packages and reference docs for Pulsar Java clients.

PackageDescriptionMaven Artifact
org.apache.pulsar.client.apiJava client API.
See Client API overview for more reference.
org.apache.pulsar:pulsar-client:3.0.7
org.apache.pulsar.client.adminJava admin API.
See Admin API overview for more reference.
org.apache.pulsar:pulsar-client-admin:3.0.7
org.apache.pulsar.client.allInclude both pulsar-client and pulsar-client-admin.
Both pulsar-client and pulsar-client-admin are independently shaded packages. Consequently, the applications using both pulsar-client and pulsar-client-admin have redundant shaded classes. It would be troublesome if you introduce new dependencies but forget to update shading rules.
In this case, you can use pulsar-client-all, which shades dependencies only one time and reduces the size of dependencies.
org.apache.pulsar:pulsar-client-all:3.0.7

More reference