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>

public class ReactivePulsarTemplate<T> extends Object implements ReactivePulsarOperations<T>
A thread-safe template for executing high-level reactive Pulsar operations.
Author:
Christophe Bornet
  • Constructor Details

    • ReactivePulsarTemplate

      public ReactivePulsarTemplate(ReactivePulsarSenderFactory<T> reactiveMessageSenderFactory)
      Construct a template instance with observation configuration.
      Parameters:
      reactiveMessageSenderFactory - the factory used to create the backing Pulsar reactive senders
  • Method Details

    • send

      public reactor.core.publisher.Mono<org.apache.pulsar.client.api.MessageId> send(T message)
      Description copied from interface: ReactivePulsarOperations
      Sends a message to the default topic in a reactive manner.
      Specified by:
      send in interface ReactivePulsarOperations<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 interface ReactivePulsarOperations<T>
      Parameters:
      topic - the topic to send the message to or null to send to the default topic
      message - 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 interface ReactivePulsarOperations<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 interface ReactivePulsarOperations<T>
      Parameters:
      topic - the topic to send the message to or null to send to the default topic
      messages - the messages to send
      Returns:
      the ids assigned by the broker to the published messages in the same order as they were sent
    • newMessage

      public ReactivePulsarTemplate.SendMessageBuilderImpl<T> newMessage(T message)
      Description copied from interface: ReactivePulsarOperations
      Create a builder for configuring and sending a message reactively.
      Specified by:
      newMessage in interface ReactivePulsarOperations<T>
      Parameters:
      message - the payload of the message
      Returns:
      the builder to configure and send the message
    • setSchema

      public void setSchema(org.apache.pulsar.client.api.Schema<T> schema)
      Set the schema to use on this template.
      Parameters:
      schema - provides the Schema used on this template