Class ConsumerConfigBuilder

  • All Implemented Interfaces:

    
    public final class ConsumerConfigBuilder
    
                        

    Builder for JetStream consumer configuration

    • Constructor Detail

      • ConsumerConfigBuilder

        ConsumerConfigBuilder()
    • Method Detail

      • getDurable

         final String getDurable()

        Durable name for the consumer If null, the consumer will be ephemeral

      • setDurable

         final Unit setDurable(String <set-?>)

        Durable name for the consumer If null, the consumer will be ephemeral

      • getAckWait

         final Duration getAckWait()

        How long to wait for acknowledgment before redelivering

      • getMaxDeliver

         final Integer getMaxDeliver()

        Maximum number of delivery attempts (-1 for unlimited)

      • getRateLimit

         final Long getRateLimit()

        Rate limit in bits per second (-1 for unlimited)

      • setRateLimit

         final Unit setRateLimit(Long <set-?>)

        Rate limit in bits per second (-1 for unlimited)

      • getMaxPullWaiting

         final Integer getMaxPullWaiting()

        Maximum number of pull requests that may wait on the consumer at once

        null - the default - leaves the limit to the server, which allows 512.

      • setMaxPullWaiting

         final Unit setMaxPullWaiting(Integer <set-?>)

        Maximum number of pull requests that may wait on the consumer at once

        null - the default - leaves the limit to the server, which allows 512.

      • getMaxBatch

         final Integer getMaxBatch()

        Largest batch a single pull request may ask this consumer for

        null - the default - leaves the limit to the server, which does not cap batches. Set it only to cap them deliberately: the server answers any larger fetch with a 409 that the client treats as a handled status, so an over-sized fetch quietly returns nothing.

      • setMaxBatch

         final Unit setMaxBatch(Integer <set-?>)

        Largest batch a single pull request may ask this consumer for

        null - the default - leaves the limit to the server, which does not cap batches. Set it only to cap them deliberately: the server answers any larger fetch with a 409 that the client treats as a handled status, so an over-sized fetch quietly returns nothing.

      • getFlowControl

         final Boolean getFlowControl()

        Enable flow control for push consumers

        Flow control prevents the server from overwhelming slow consumers. When enabled, the server sends flow control messages that the NATS client automatically handles. Requires idleHeartbeat to be set.

        Note: Only valid for push consumers (requires deliverSubject).

      • setFlowControl

         final Unit setFlowControl(Boolean <set-?>)

        Enable flow control for push consumers

        Flow control prevents the server from overwhelming slow consumers. When enabled, the server sends flow control messages that the NATS client automatically handles. Requires idleHeartbeat to be set.

        Note: Only valid for push consumers (requires deliverSubject).

      • getIdleHeartbeat

         final Duration getIdleHeartbeat()

        Idle heartbeat interval for push consumers

        The server will send heartbeat messages if no data messages are sent within this interval. This allows the consumer to detect connectivity issues.

        When flowControl is enabled, this value determines both the flow control and heartbeat interval. Recommended minimum: 1 second (avoid values like 500ms which cause excessive server load).

      • setIdleHeartbeat

         final Unit setIdleHeartbeat(Duration <set-?>)

        Idle heartbeat interval for push consumers

        The server will send heartbeat messages if no data messages are sent within this interval. This allows the consumer to detect connectivity issues.

        When flowControl is enabled, this value determines both the flow control and heartbeat interval. Recommended minimum: 1 second (avoid values like 500ms which cause excessive server load).

      • getStartSequence

         final Long getStartSequence()

        Start sequence for BY_START_SEQUENCE deliver policy

      • getReplicas

         final Integer getReplicas()

        Number of replicas for the consumer (-1 for stream default)

      • setReplicas

         final Unit setReplicas(Integer <set-?>)

        Number of replicas for the consumer (-1 for stream default)