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 template for executing high-level reactive Pulsar operations.
Author:
Christophe Bornet
  • Nested Class Summary

  • Constructor Summary

    Constructors
    Constructor
    Description
    ReactivePulsarTemplate(ReactivePulsarSenderFactory<T> reactiveMessageSenderFactory)
    Construct a template instance that uses the default schema resolver and topic resolver.
    ReactivePulsarTemplate(ReactivePulsarSenderFactory<T> reactiveMessageSenderFactory, SchemaResolver schemaResolver, TopicResolver topicResolver)
    Construct a template instance with a custom schema resolver and a custom topic resolver.
  • Method Summary

    Modifier and Type
    Method
    Description
    newMessage(T message)
    Create a builder for configuring and sending a message reactively.
    newMessages(org.reactivestreams.Publisher<org.apache.pulsar.reactive.client.api.MessageSpec<T>> messages)
    Create a builder for configuring and sending multiple messages reactively.
    reactor.core.publisher.Flux<org.apache.pulsar.reactive.client.api.MessageSendResult<T>>
    send(String topic, org.reactivestreams.Publisher<org.apache.pulsar.reactive.client.api.MessageSpec<T>> messages)
    Sends multiple messages to the specified topic in a reactive manner.
    reactor.core.publisher.Flux<org.apache.pulsar.reactive.client.api.MessageSendResult<T>>
    send(String topic, org.reactivestreams.Publisher<org.apache.pulsar.reactive.client.api.MessageSpec<T>> messages, org.apache.pulsar.client.api.Schema<T> schema)
    Sends multiple messages to the specified topic in a reactive manner.
    reactor.core.publisher.Mono<org.apache.pulsar.client.api.MessageId>
    send(String topic, T message)
    Sends a message to the specified topic in a reactive manner.
    reactor.core.publisher.Mono<org.apache.pulsar.client.api.MessageId>
    send(String topic, T message, org.apache.pulsar.client.api.Schema<T> schema)
    Sends a message to the specified topic in a reactive manner.
    reactor.core.publisher.Flux<org.apache.pulsar.reactive.client.api.MessageSendResult<T>>
    send(org.reactivestreams.Publisher<org.apache.pulsar.reactive.client.api.MessageSpec<T>> messages)
    Sends multiple messages to the default topic in a reactive manner.
    reactor.core.publisher.Flux<org.apache.pulsar.reactive.client.api.MessageSendResult<T>>
    send(org.reactivestreams.Publisher<org.apache.pulsar.reactive.client.api.MessageSpec<T>> messages, org.apache.pulsar.client.api.Schema<T> schema)
    Sends multiple messages to the default topic in a reactive manner.
    reactor.core.publisher.Mono<org.apache.pulsar.client.api.MessageId>
    send(T message)
    Sends a message to the default topic in a reactive manner.
    reactor.core.publisher.Mono<org.apache.pulsar.client.api.MessageId>
    send(T message, org.apache.pulsar.client.api.Schema<T> schema)
    Sends a message to the specified topic in a reactive manner.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ReactivePulsarTemplate

      public ReactivePulsarTemplate(ReactivePulsarSenderFactory<T> reactiveMessageSenderFactory)
      Construct a template instance that uses the default schema resolver and topic resolver.
      Parameters:
      reactiveMessageSenderFactory - the factory used to create the backing Pulsar reactive senders
    • ReactivePulsarTemplate

      public ReactivePulsarTemplate(ReactivePulsarSenderFactory<T> reactiveMessageSenderFactory, SchemaResolver schemaResolver, TopicResolver topicResolver)
      Construct a template instance with a custom schema resolver and a custom topic resolver.
      Parameters:
      reactiveMessageSenderFactory - the factory used to create the backing Pulsar
      schemaResolver - the schema resolver to use
      topicResolver - the topic resolver to use
  • Method Details

    • send

      public reactor.core.publisher.Mono<org.apache.pulsar.client.api.MessageId> send(@Nullable 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(@Nullable T message, @Nullable org.apache.pulsar.client.api.Schema<T> schema)
      Description copied from interface: ReactivePulsarOperations
      Sends a message to the specified topic in a reactive manner. default topic
      Specified by:
      send in interface ReactivePulsarOperations<T>
      Parameters:
      message - the message to send
      schema - the schema to use or null to use the default schema resolution
      Returns:
      the id assigned by the broker to the published message
    • send

      public reactor.core.publisher.Mono<org.apache.pulsar.client.api.MessageId> send(@Nullable String topic, @Nullable 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.Mono<org.apache.pulsar.client.api.MessageId> send(@Nullable String topic, @Nullable T message, @Nullable org.apache.pulsar.client.api.Schema<T> schema)
      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
      schema - the schema to use or null to use the default schema resolution
      Returns:
      the id assigned by the broker to the published message
    • send

      public reactor.core.publisher.Flux<org.apache.pulsar.reactive.client.api.MessageSendResult<T>> send(org.reactivestreams.Publisher<org.apache.pulsar.reactive.client.api.MessageSpec<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.reactive.client.api.MessageSendResult<T>> send(org.reactivestreams.Publisher<org.apache.pulsar.reactive.client.api.MessageSpec<T>> messages, @Nullable org.apache.pulsar.client.api.Schema<T> schema)
      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
      schema - the schema to use or null to use the default schema resolution
      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.reactive.client.api.MessageSendResult<T>> send(@Nullable String topic, org.reactivestreams.Publisher<org.apache.pulsar.reactive.client.api.MessageSpec<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
    • send

      public reactor.core.publisher.Flux<org.apache.pulsar.reactive.client.api.MessageSendResult<T>> send(@Nullable String topic, org.reactivestreams.Publisher<org.apache.pulsar.reactive.client.api.MessageSpec<T>> messages, @Nullable org.apache.pulsar.client.api.Schema<T> schema)
      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
      schema - the schema to use or null to use the default schema resolution
      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 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
    • newMessages

      public ReactivePulsarOperations.SendManyMessageBuilder<T> newMessages(org.reactivestreams.Publisher<org.apache.pulsar.reactive.client.api.MessageSpec<T>> messages)
      Description copied from interface: ReactivePulsarOperations
      Create a builder for configuring and sending multiple messages reactively.
      Specified by:
      newMessages in interface ReactivePulsarOperations<T>
      Parameters:
      messages - the messages to send
      Returns:
      the builder to configure and send the message