Class ReactivePulsarTemplate<T>
java.lang.Object
org.springframework.pulsar.reactive.core.ReactivePulsarTemplate<T>
- Type Parameters:
T
- the message payload type
- All Implemented Interfaces:
ReactivePulsarOperations<T>
A thread-safe template for executing high-level reactive Pulsar operations.
- Author:
- Christophe Bornet
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.pulsar.reactive.core.ReactivePulsarOperations
ReactivePulsarOperations.SendMessageBuilder<T>
-
Constructor Summary
ConstructorDescriptionReactivePulsarTemplate
(ReactivePulsarSenderFactory<T> reactiveMessageSenderFactory) Construct a template instance with observation configuration. -
Method Summary
Modifier and TypeMethodDescriptionnewMessage
(T message) Create abuilder
for configuring and sending a message reactively.reactor.core.publisher.Flux<org.apache.pulsar.client.api.MessageId>
Sends multiple messages to the specified topic in a reactive manner.reactor.core.publisher.Mono<org.apache.pulsar.client.api.MessageId>
Sends a message to the specified topic in a reactive manner.reactor.core.publisher.Flux<org.apache.pulsar.client.api.MessageId>
Sends multiple messages to the default topic in a reactive manner.reactor.core.publisher.Mono<org.apache.pulsar.client.api.MessageId>
Sends a message to the default topic in a reactive manner.void
Set the schema to use on this template.
-
Constructor Details
-
ReactivePulsarTemplate
Construct a template instance with observation configuration.- Parameters:
reactiveMessageSenderFactory
- the factory used to create the backing Pulsar reactive senders
-
-
Method Details
-
send
Description copied from interface:ReactivePulsarOperations
Sends a message to the default topic in a reactive manner.- Specified by:
send
in interfaceReactivePulsarOperations<T>
- Parameters:
message
- the message to send- Returns:
- the id assigned by the broker to the published message
-
send
public reactor.core.publisher.Mono<org.apache.pulsar.client.api.MessageId> send(String topic, T message) Description copied from interface:ReactivePulsarOperations
Sends a message to the specified topic in a reactive manner.- Specified by:
send
in interfaceReactivePulsarOperations<T>
- Parameters:
topic
- the topic to send the message to ornull
to send to the default topicmessage
- the message to send- Returns:
- the id assigned by the broker to the published message
-
send
public reactor.core.publisher.Flux<org.apache.pulsar.client.api.MessageId> send(org.reactivestreams.Publisher<T> messages) Description copied from interface:ReactivePulsarOperations
Sends multiple messages to the default topic in a reactive manner.- Specified by:
send
in interfaceReactivePulsarOperations<T>
- Parameters:
messages
- the messages to send- Returns:
- the ids assigned by the broker to the published messages in the same order as they were sent
-
send
public reactor.core.publisher.Flux<org.apache.pulsar.client.api.MessageId> send(String topic, org.reactivestreams.Publisher<T> messages) Description copied from interface:ReactivePulsarOperations
Sends multiple messages to the specified topic in a reactive manner.- Specified by:
send
in interfaceReactivePulsarOperations<T>
- Parameters:
topic
- the topic to send the message to ornull
to send to the default topicmessages
- the messages to send- Returns:
- the ids assigned by the broker to the published messages in the same order as they were sent
-
newMessage
Description copied from interface:ReactivePulsarOperations
Create abuilder
for configuring and sending a message reactively.- Specified by:
newMessage
in interfaceReactivePulsarOperations<T>
- Parameters:
message
- the payload of the message- Returns:
- the builder to configure and send the message
-
setSchema
Set the schema to use on this template.- Parameters:
schema
- provides theSchema
used on this template
-