Interface MessageBuilder<T>

Type Parameters:
T - the type of the message value
All Superinterfaces:
MessageMetadata<T,MessageBuilder<T>>

public interface MessageBuilder<T> extends MessageMetadata<T,MessageBuilder<T>>
Synchronous message builder, obtained from Producer.newMessage().

Inherits all metadata setters from MessageMetadata and adds a blocking send() terminal operation.

  • Method Details

    • send

      Send the message synchronously and return its message ID.
      Returns:
      the MessageId assigned to the published message by the broker
      Throws:
      PulsarClientException - if the message could not be sent (e.g., connection failure, send timeout, or topic authorization error)