Package io.hstream

Interface ConsumerBuilder


  • public interface ConsumerBuilder
    A builder for Consumers.
    • Method Detail

      • name

        ConsumerBuilder name​(String name)
        Optional, if not provided, the ConsumerBuilder will generate a unique name.
        Parameters:
        name - consumer name
        Returns:
        the ConsumerBuilder instance
      • subscription

        ConsumerBuilder subscription​(String subscription)
        Positional
        Parameters:
        subscription - subscription name
        Returns:
        the ConsumerBuilder instance
      • rawRecordReceiver

        ConsumerBuilder rawRecordReceiver​(RawRecordReceiver rawRecordReceiver)
        Optional, when the consumer receives raw records, rawRecordReceiver is executed sequentially for each record, if rawRecordReceiver throws an exception, the consumer will ignore it and consume the next record.
        Parameters:
        rawRecordReceiver - raw record receiver
        Returns:
        the ConsumerBuilder instance
      • hRecordReceiver

        ConsumerBuilder hRecordReceiver​(HRecordReceiver hRecordReceiver)
        Same as rawRecordReceiver except receiving HRecord instead of raw record.
        Parameters:
        hRecordReceiver - HRecord receiver
        Returns:
        the ConsumerBuilder instance
      • ackBufferSize

        ConsumerBuilder ackBufferSize​(int ackBufferSize)
        When Responder.ack() is called, the consumer will not send it to servers immediately, the ack request will be buffered until the ack count reaches ackBufferSize or the consumer is stopping.
        Parameters:
        ackBufferSize - ack buffer size
        Returns:
        the ConsumerBuilder instance
      • ackAgeLimit

        ConsumerBuilder ackAgeLimit​(long ackAgeLimit)
        Optional, default: 100(ms), the value should be less than Subscription.ackTimeoutSeconds.
        Parameters:
        ackAgeLimit - the ack age limit(Milliseconds)
        Returns:
        the ConsumerBuilder instance