Class AbstractBatchMessageContainer

  • All Implemented Interfaces:
    org.apache.pulsar.client.api.BatchMessageContainer, BatchMessageContainerBase

    public abstract class AbstractBatchMessageContainer
    extends java.lang.Object
    implements BatchMessageContainerBase
    Batch message container framework.
    • Field Detail

      • compressionType

        protected org.apache.pulsar.common.api.proto.CompressionType compressionType
      • compressor

        protected org.apache.pulsar.common.compression.CompressionCodec compressor
      • topicName

        protected java.lang.String topicName
      • producerName

        protected java.lang.String producerName
      • maxNumMessagesInBatch

        protected int maxNumMessagesInBatch
      • maxBytesInBatch

        protected int maxBytesInBatch
      • numMessagesInBatch

        protected int numMessagesInBatch
      • currentBatchSizeBytes

        protected long currentBatchSizeBytes
      • currentTxnidMostBits

        protected long currentTxnidMostBits
      • currentTxnidLeastBits

        protected long currentTxnidLeastBits
      • INITIAL_BATCH_BUFFER_SIZE

        protected static final int INITIAL_BATCH_BUFFER_SIZE
        See Also:
        Constant Field Values
      • maxBatchSize

        protected int maxBatchSize
    • Constructor Detail

      • AbstractBatchMessageContainer

        public AbstractBatchMessageContainer()
    • Method Detail

      • haveEnoughSpace

        public boolean haveEnoughSpace​(MessageImpl<?> msg)
        Description copied from interface: BatchMessageContainerBase
        Check the batch message container have enough space for the message want to add.
        Specified by:
        haveEnoughSpace in interface BatchMessageContainerBase
        Parameters:
        msg - the message want to add
        Returns:
        return true if the container have enough space for the specific message, otherwise return false.
      • isBatchFull

        protected boolean isBatchFull()
      • getNumMessagesInBatch

        public int getNumMessagesInBatch()
        Specified by:
        getNumMessagesInBatch in interface org.apache.pulsar.client.api.BatchMessageContainer
      • getCurrentBatchSize

        public long getCurrentBatchSize()
        Specified by:
        getCurrentBatchSize in interface org.apache.pulsar.client.api.BatchMessageContainer