In this scenario, you will:
- Create a Pulsar producer client in Java
- Create a Pulsar consumer client in Java
- Create a Pulsar reader client in Java
- Use multiple consumers with a shared subscription on a topic to create a work queue ("competing consumers" pattern)
- Use readers to replay messages from a topic starting at the earliest available message
Check out our datastax.com/dev site, where you can find many more resources to help you succeed with Apache Cassandra™.
In this scenario, you learned how to:
- Create a Pulsar producer client in Java
- Create a Pulsar consumer client in Java
- Create a Pulsar reader client in Java
- Use multiple consumers with a shared subscription on a topic to create a work queue ("competing consumers" pattern)
- Use readers to replay messages from a topic starting at the earliest available message

Steps
Creating Apache Pulsar™ Producers, Consumers and Readers in Java
Explore How Java Projects are Configured
In this scenario, Apache Pulsar™ Producer, Consumer and Reader applications are created using Apache Maven™. The three projects have identical configurations.
Start by exploring a project configuration in one of the pom.xml files below (click to open):
my-pulsar-producer/pom.xml
my-pulsar-consumer/pom.xml
my-pulsar-reader/pom.xml
Most importantly, verify the properties and dependencies:
<!-- in your <properties> block -->
<pulsar.version>2.6.2</pulsar.version>
<!-- in your <dependencies> block -->
<dependency>
<groupId>org.apache.pulsar</groupId>
<artifactId>pulsar-client</artifactId>
<version>${pulsar.version}</version>
</dependency>