Interface PulsarOperations.SendMessageBuilder<T>

Type Parameters:
T - the message payload type
All Known Implementing Classes:
PulsarTemplate.SendMessageBuilderImpl
Enclosing interface:
PulsarOperations<T>

public static interface PulsarOperations.SendMessageBuilder<T>
Builder that can be used to configure and send a message. Provides more options than the basic send/sendAsync methods provided by PulsarOperations.
  • Method Details

    • withTopic

      Specify the topic to send the message to.
      Parameters:
      topic - the destination topic
      Returns:
      the current builder with the destination topic specified
    • withSchema

      PulsarOperations.SendMessageBuilder<T> withSchema(org.apache.pulsar.client.api.Schema<T> schema)
      Specify the schema to use when sending the message.
      Parameters:
      schema - the schema to use
      Returns:
      the current builder with the schema specified
    • withEncryptionKeys

      PulsarOperations.SendMessageBuilder<T> withEncryptionKeys(Collection<String> encryptionKeys)
      Specify the encryption keys to use.
      Parameters:
      encryptionKeys - the encryption keys
      Returns:
      the current builder with the encryption keys specified
    • withMessageCustomizer

      PulsarOperations.SendMessageBuilder<T> withMessageCustomizer(TypedMessageBuilderCustomizer<T> messageCustomizer)
      Specifies the message customizer to use to further configure the message.
      Parameters:
      messageCustomizer - the message customizer
      Returns:
      the current builder with the message customizer specified
    • withProducerCustomizer

      PulsarOperations.SendMessageBuilder<T> withProducerCustomizer(ProducerBuilderCustomizer<T> producerCustomizer)
      Specifies the customizer to use to further configure the producer builder.
      Parameters:
      producerCustomizer - the producer builder customizer
      Returns:
      the current builder with the producer builder customizer specified
    • send

      org.apache.pulsar.client.api.MessageId send() throws org.apache.pulsar.client.api.PulsarClientException
      Send the message in a blocking manner using the configured specification.
      Returns:
      the id assigned by the broker to the published message
      Throws:
      org.apache.pulsar.client.api.PulsarClientException - if an error occurs
    • sendAsync

      CompletableFuture<org.apache.pulsar.client.api.MessageId> sendAsync() throws org.apache.pulsar.client.api.PulsarClientException
      Uses the configured specification to send the message in a non-blocking manner.
      Returns:
      a future that holds the id assigned by the broker to the published message
      Throws:
      org.apache.pulsar.client.api.PulsarClientException - if an error occurs