Interface PulsarOperations<T>

Type Parameters:
T - the message payload type
All Known Implementing Classes:
PulsarTemplate

public interface PulsarOperations<T>
The basic Pulsar operations contract.
Author:
Chris Bono, Alexander Preuß, Jonas Geiregat
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Builder that can be used to configure and send a message.
  • Method Summary

    Modifier and Type
    Method
    Description
    newMessage(T message)
    Create a builder for configuring and sending a message.
    org.apache.pulsar.client.api.MessageId
    send(String topic, T message)
    Sends a message to the specified topic in a blocking manner.
    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 blocking manner.
    org.apache.pulsar.client.api.MessageId
    send(T message)
    Sends a message to the default topic in a blocking manner.
    org.apache.pulsar.client.api.MessageId
    send(T message, org.apache.pulsar.client.api.Schema<T> schema)
    Sends a message to the default topic in a blocking manner.
    CompletableFuture<org.apache.pulsar.client.api.MessageId>
    sendAsync(String topic, T message)
    Sends a message to the specified topic in a non-blocking manner.
    CompletableFuture<org.apache.pulsar.client.api.MessageId>
    sendAsync(String topic, T message, org.apache.pulsar.client.api.Schema<T> schema)
    Sends a message to the specified topic in a non-blocking manner.
    CompletableFuture<org.apache.pulsar.client.api.MessageId>
    sendAsync(T message)
    Sends a message to the default topic in a non-blocking manner.
    CompletableFuture<org.apache.pulsar.client.api.MessageId>
    sendAsync(T message, org.apache.pulsar.client.api.Schema<T> schema)
    Sends a message to the default topic in a non-blocking manner.
  • Method Details

    • send

      org.apache.pulsar.client.api.MessageId send(@Nullable T message)
      Sends a message to the default topic in a blocking manner.
      Parameters:
      message - the message to send
      Returns:
      the id assigned by the broker to the published message
      Throws:
      PulsarException - if any PulsarClientException occurs communicating with Pulsar
    • send

      org.apache.pulsar.client.api.MessageId send(@Nullable T message, @Nullable org.apache.pulsar.client.api.Schema<T> schema)
      Sends a message to the default topic in a blocking manner.
      Parameters:
      message - the message to send
      schema - the schema to use or null to send using the default schema resolution
      Returns:
      the id assigned by the broker to the published message
      Throws:
      PulsarException - if any PulsarClientException occurs communicating with Pulsar
    • send

      org.apache.pulsar.client.api.MessageId send(@Nullable String topic, @Nullable T message)
      Sends a message to the specified topic in a blocking manner.
      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
      Throws:
      PulsarException - if any PulsarClientException occurs communicating with Pulsar
    • send

      org.apache.pulsar.client.api.MessageId send(@Nullable String topic, @Nullable T message, @Nullable org.apache.pulsar.client.api.Schema<T> schema)
      Sends a message to the specified topic in a blocking manner.
      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 send using the default schema resolution
      Returns:
      the id assigned by the broker to the published message
      Throws:
      PulsarException - if any PulsarClientException occurs communicating with Pulsar
    • sendAsync

      CompletableFuture<org.apache.pulsar.client.api.MessageId> sendAsync(@Nullable T message)
      Sends a message to the default topic in a non-blocking manner.
      Parameters:
      message - the message to send
      Returns:
      a future that holds the id assigned by the broker to the published message
      Throws:
      PulsarException - if any PulsarClientException occurs communicating with Pulsar
    • sendAsync

      CompletableFuture<org.apache.pulsar.client.api.MessageId> sendAsync(@Nullable T message, @Nullable org.apache.pulsar.client.api.Schema<T> schema)
      Sends a message to the default topic in a non-blocking manner.
      Parameters:
      message - the message to send
      schema - the schema to use or null to send using the default schema resolution
      Returns:
      a future that holds the id assigned by the broker to the published message
      Throws:
      PulsarException - if any PulsarClientException occurs communicating with Pulsar
    • sendAsync

      CompletableFuture<org.apache.pulsar.client.api.MessageId> sendAsync(@Nullable String topic, @Nullable T message)
      Sends a message to the specified topic in a non-blocking manner.
      Parameters:
      topic - the topic to send the message to or null to send to the default topic
      message - the message to send
      Returns:
      a future that holds the id assigned by the broker to the published message
      Throws:
      PulsarException - if any PulsarClientException occurs communicating with Pulsar
    • sendAsync

      CompletableFuture<org.apache.pulsar.client.api.MessageId> sendAsync(@Nullable String topic, @Nullable T message, @Nullable org.apache.pulsar.client.api.Schema<T> schema) throws PulsarException
      Sends a message to the specified topic in a non-blocking manner.
      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 send using the default schema resolution
      Returns:
      a future that holds the id assigned by the broker to the published message
      Throws:
      PulsarException - if any PulsarClientException occurs communicating with Pulsar
    • newMessage

      Create a builder for configuring and sending a message.
      Parameters:
      message - the payload of the message
      Returns:
      the builder to configure and send the message