https://github.com/rpuch/pulsar-reactive-client
Pulsar Reactive Client enables using Apache Pulsar in reactive applications based on Reactive Streams implementations
https://github.com/rpuch/pulsar-reactive-client
client pulsar reactive reactor
Last synced: 2 months ago
JSON representation
Pulsar Reactive Client enables using Apache Pulsar in reactive applications based on Reactive Streams implementations
- Host: GitHub
- URL: https://github.com/rpuch/pulsar-reactive-client
- Owner: rpuch
- License: apache-2.0
- Created: 2021-02-23T17:35:44.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-06-28T18:20:31.000Z (9 months ago)
- Last Synced: 2025-08-01T13:46:00.441Z (8 months ago)
- Topics: client, pulsar, reactive, reactor
- Language: Java
- Homepage:
- Size: 218 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://search.maven.org/search?q=g:%22com.rpuch.pulsar-reactive-client%22%20AND%20a:%22pulsar-client-reactor%22)
[](https://github.com/rpuch/pulsar-reactive-client/actions/workflows/maven.yml)
[](https://codecov.io/gh/rpuch/pulsar-reactive-client)
# Pulsar Reactive Client #
This is a wrapper around asynchronous facilities provided by the official
[Apache Pulsar Java Client](https://github.com/apache/pulsar/tree/master/pulsar-client) using
[Reactor Core](https://github.com/reactor/reactor-core) interfaces.
## How to use ##
### Maven ###
```xml
com.rpuch.pulsar-reactive-client
pulsar-client-reactor
1.1.0
```
### Gradle ###
```
implementation 'com.rpuch.pulsar-reactive-client:pulsar-client-reactor:1.1.0'
```
### Create a reactive client ###
```java
PulsarClient coreClient = PulsarClient.builder().serviceUrl(pulsarBrokerUrl).build();
ReactivePulsarClient client = ReactivePulsarClient.from(coreClient);
```
### Produce a message ###
```java
MessageId messageId = client.newProducer()
.topic("my-topic")
.forOne(producer -> producer.send("Hello!".bytes()))
.block();
```
### Consume an infinite stream of messaging acknowledging each after processing it starting at the very beginning of a topic ###
```java
client.newConsumer()
.topic("my-topic")
.subscriptionName("my-subscription")
.subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
.forMany(consumer -> consumer.messages().concatMap(message -> {
String str = new String(msg.getData());
System.out.println(str);
return consumer.acknowledge(message);
}))
.subscribe();
```
### Receive an infinite stream of messages starting at the very beginning of a topic ###
```java
Flux> messages = client.newReader()
.topic("my-topic")
.startMessageId(MessageId.earliest)
.messages();
messages.map(msg -> new String(msg.getData())).subscribe(System.out::println);
```
## Missing features, coming soon ##
* Support for fast message publishing, batches and chunked messages
* Support for transactions
* Addition of support for `RxJava` and alternatives Reactive Streams implementations (like Mutiny)
is under consideration