Class AbstractBaseDispatcher

    • Field Detail

      • serviceConfig

        protected final org.apache.pulsar.broker.ServiceConfiguration serviceConfig
    • Constructor Detail

      • AbstractBaseDispatcher

        protected AbstractBaseDispatcher​(Subscription subscription,
                                         org.apache.pulsar.broker.ServiceConfiguration serviceConfig)
    • Method Detail

      • updateEntryWrapperWithMetadata

        protected int updateEntryWrapperWithMetadata​(EntryWrapper[] entryWrappers,
                                                     java.util.List<org.apache.bookkeeper.mledger.Entry> entries)
        Update Entries with the metadata of each entry.
        Parameters:
        entries -
        Returns:
      • filterEntriesForConsumer

        public void filterEntriesForConsumer​(java.util.List<org.apache.bookkeeper.mledger.Entry> entries,
                                             EntryBatchSizes batchSizes,
                                             SendMessageInfo sendMessageInfo,
                                             EntryBatchIndexesAcks indexesAcks,
                                             org.apache.bookkeeper.mledger.ManagedCursor cursor,
                                             boolean isReplayRead)
        Filter messages that are being sent to a consumers.

        Messages can be filtered out for multiple reasons:

        • Checksum or metadata corrupted
        • Message is an internal marker
        • Message is not meant to be delivered immediately
        Parameters:
        entries - a list of entries as read from storage
        batchSizes - an array where the batch size for each entry (the number of messages within an entry) is stored. This array needs to be of at least the same size as the entries list
        sendMessageInfo - an object where the total size in messages and bytes will be returned back to the caller
      • filterEntriesForConsumer

        public void filterEntriesForConsumer​(java.util.Optional<EntryWrapper[]> entryWrapper,
                                             int entryWrapperOffset,
                                             java.util.List<org.apache.bookkeeper.mledger.Entry> entries,
                                             EntryBatchSizes batchSizes,
                                             SendMessageInfo sendMessageInfo,
                                             EntryBatchIndexesAcks indexesAcks,
                                             org.apache.bookkeeper.mledger.ManagedCursor cursor,
                                             boolean isReplayRead)
      • isConsumersExceededOnSubscription

        protected abstract boolean isConsumersExceededOnSubscription()
        Determine whether the number of consumers on the subscription reaches the threshold.
        Returns:
      • isConsumersExceededOnSubscription

        protected boolean isConsumersExceededOnSubscription​(BrokerService brokerService,
                                                            AbstractTopic topic,
                                                            int consumerSize)
      • computeReadLimits

        protected static org.apache.commons.lang3.tuple.Pair<java.lang.Integer,​java.lang.Long> computeReadLimits​(int messagesToRead,
                                                                                                                       int availablePermitsOnMsg,
                                                                                                                       long bytesToRead,
                                                                                                                       long availablePermitsOnByte)
      • peekStickyKey

        protected byte[] peekStickyKey​(io.netty.buffer.ByteBuf metadataAndPayload)