Class ChunkingPolicy

java.lang.Object
org.apache.pulsar.client.api.v5.config.ChunkingPolicy

public final class ChunkingPolicy extends Object
Configuration for chunking large messages that exceed the broker's max message size.

When chunking is enabled, the producer splits a payload larger than the configured chunk size into smaller pieces that are reassembled by the consumer.

Use ofDisabled() to opt out, or builder() to enable with a specific chunk size.

  • Method Details

    • enabled

      public boolean enabled()
      Returns:
      whether chunking is enabled
    • chunkSize

      public int chunkSize()
      Returns:
      the maximum size of each chunk in bytes (only meaningful when enabled())
    • ofDisabled

      public static ChunkingPolicy ofDisabled()
      Chunking disabled.
      Returns:
      a ChunkingPolicy with chunking disabled
    • builder

      public static ChunkingPolicy.Builder builder()
      Returns:
      a new builder for constructing a ChunkingPolicy