Class ConsumerConfigBuilder
-
- All Implemented Interfaces:
public final class ConsumerConfigBuilderBuilder for JetStream consumer configuration
-
-
Field Summary
Fields Modifier and Type Field Description private Stringdurableprivate DeliverPolicydeliverPolicyprivate AckPolicyackPolicyprivate DurationackWaitprivate IntegermaxDeliverprivate StringfilterSubjectprivate ReplayPolicyreplayPolicyprivate IntegersampleFrequencyprivate LongrateLimitprivate IntegermaxAckPendingprivate IntegermaxPullWaitingprivate IntegermaxBatchprivate DurationmaxExpiresprivate DurationinactiveThresholdprivate Stringdescriptionprivate StringdeliverGroupprivate BooleanflowControlprivate DurationidleHeartbeatprivate BooleanheadersOnlyprivate LongstartSequenceprivate ZonedDateTimestartTimeprivate StringdeliverSubjectprivate Integerreplicasprivate BooleanmemoryStorage
-
Constructor Summary
Constructors Constructor Description ConsumerConfigBuilder()
-
Method Summary
Modifier and Type Method Description final StringgetDurable()Durable name for the consumer If null, the consumer will be ephemeral final UnitsetDurable(String <set-?>)Durable name for the consumer If null, the consumer will be ephemeral final DeliverPolicygetDeliverPolicy()Deliver policy determines where to start consuming messages final UnitsetDeliverPolicy(DeliverPolicy <set-?>)Deliver policy determines where to start consuming messages final AckPolicygetAckPolicy()Acknowledgment policy for message processing final UnitsetAckPolicy(AckPolicy <set-?>)Acknowledgment policy for message processing final DurationgetAckWait()How long to wait for acknowledgment before redelivering final UnitsetAckWait(Duration <set-?>)How long to wait for acknowledgment before redelivering final IntegergetMaxDeliver()Maximum number of delivery attempts (-1 for unlimited) final UnitsetMaxDeliver(Integer <set-?>)Maximum number of delivery attempts (-1 for unlimited) final StringgetFilterSubject()Filter messages by subject final UnitsetFilterSubject(String <set-?>)Filter messages by subject final ReplayPolicygetReplayPolicy()Replay policy for message delivery final UnitsetReplayPolicy(ReplayPolicy <set-?>)Replay policy for message delivery final IntegergetSampleFrequency()Sample frequency for metrics (0-100, 0 = disabled) final UnitsetSampleFrequency(Integer <set-?>)Sample frequency for metrics (0-100, 0 = disabled) final LonggetRateLimit()Rate limit in bits per second (-1 for unlimited) final UnitsetRateLimit(Long <set-?>)Rate limit in bits per second (-1 for unlimited) final IntegergetMaxAckPending()Maximum number of outstanding unacknowledged messages final UnitsetMaxAckPending(Integer <set-?>)Maximum number of outstanding unacknowledged messages final IntegergetMaxPullWaiting()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.final UnitsetMaxPullWaiting(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.final IntegergetMaxBatch()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.final UnitsetMaxBatch(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.final DurationgetMaxExpires()Maximum expiration duration for pull requests final UnitsetMaxExpires(Duration <set-?>)Maximum expiration duration for pull requests final DurationgetInactiveThreshold()Inactivity threshold before consumer is considered inactive final UnitsetInactiveThreshold(Duration <set-?>)Inactivity threshold before consumer is considered inactive final StringgetDescription()Description of the consumer final UnitsetDescription(String <set-?>)Description of the consumer final StringgetDeliverGroup()Deliver group for queue semantics (push consumers only) final UnitsetDeliverGroup(String <set-?>)Deliver group for queue semantics (push consumers only) final BooleangetFlowControl()Enable flow control for push consumersFlow control prevents the server from overwhelming slow consumers. final UnitsetFlowControl(Boolean <set-?>)Enable flow control for push consumersFlow control prevents the server from overwhelming slow consumers. final DurationgetIdleHeartbeat()Idle heartbeat interval for push consumersThe server will send heartbeat messages if no data messages are sent within this interval. final UnitsetIdleHeartbeat(Duration <set-?>)Idle heartbeat interval for push consumersThe server will send heartbeat messages if no data messages are sent within this interval. final BooleangetHeadersOnly()Deliver only headers, not payloads final UnitsetHeadersOnly(Boolean <set-?>)Deliver only headers, not payloads final LonggetStartSequence()Start sequence for BY_START_SEQUENCE deliver policy final UnitsetStartSequence(Long <set-?>)Start sequence for BY_START_SEQUENCE deliver policy final ZonedDateTimegetStartTime()Start time for BY_START_TIME deliver policy final UnitsetStartTime(ZonedDateTime <set-?>)Start time for BY_START_TIME deliver policy final StringgetDeliverSubject()Deliver subject for push consumers final UnitsetDeliverSubject(String <set-?>)Deliver subject for push consumers final IntegergetReplicas()Number of replicas for the consumer (-1 for stream default) final UnitsetReplicas(Integer <set-?>)Number of replicas for the consumer (-1 for stream default) final BooleangetMemoryStorage()Enable memory storage for the consumer state final UnitsetMemoryStorage(Boolean <set-?>)Enable memory storage for the consumer state -
-
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
-
getDeliverPolicy
final DeliverPolicy getDeliverPolicy()
Deliver policy determines where to start consuming messages
-
setDeliverPolicy
final Unit setDeliverPolicy(DeliverPolicy <set-?>)
Deliver policy determines where to start consuming messages
-
getAckPolicy
final AckPolicy getAckPolicy()
Acknowledgment policy for message processing
-
setAckPolicy
final Unit setAckPolicy(AckPolicy <set-?>)
Acknowledgment policy for message processing
-
getAckWait
final Duration getAckWait()
How long to wait for acknowledgment before redelivering
-
setAckWait
final Unit setAckWait(Duration <set-?>)
How long to wait for acknowledgment before redelivering
-
getMaxDeliver
final Integer getMaxDeliver()
Maximum number of delivery attempts (-1 for unlimited)
-
setMaxDeliver
final Unit setMaxDeliver(Integer <set-?>)
Maximum number of delivery attempts (-1 for unlimited)
-
getFilterSubject
final String getFilterSubject()
Filter messages by subject
-
setFilterSubject
final Unit setFilterSubject(String <set-?>)
Filter messages by subject
-
getReplayPolicy
final ReplayPolicy getReplayPolicy()
Replay policy for message delivery
-
setReplayPolicy
final Unit setReplayPolicy(ReplayPolicy <set-?>)
Replay policy for message delivery
-
getSampleFrequency
final Integer getSampleFrequency()
Sample frequency for metrics (0-100, 0 = disabled)
-
setSampleFrequency
final Unit setSampleFrequency(Integer <set-?>)
Sample frequency for metrics (0-100, 0 = disabled)
-
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)
-
getMaxAckPending
final Integer getMaxAckPending()
Maximum number of outstanding unacknowledged messages
-
setMaxAckPending
final Unit setMaxAckPending(Integer <set-?>)
Maximum number of outstanding unacknowledged messages
-
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.
-
getMaxExpires
final Duration getMaxExpires()
Maximum expiration duration for pull requests
-
setMaxExpires
final Unit setMaxExpires(Duration <set-?>)
Maximum expiration duration for pull requests
-
getInactiveThreshold
final Duration getInactiveThreshold()
Inactivity threshold before consumer is considered inactive
-
setInactiveThreshold
final Unit setInactiveThreshold(Duration <set-?>)
Inactivity threshold before consumer is considered inactive
-
getDescription
final String getDescription()
Description of the consumer
-
setDescription
final Unit setDescription(String <set-?>)
Description of the consumer
-
getDeliverGroup
final String getDeliverGroup()
Deliver group for queue semantics (push consumers only)
-
setDeliverGroup
final Unit setDeliverGroup(String <set-?>)
Deliver group for queue semantics (push consumers only)
-
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).
-
getHeadersOnly
final Boolean getHeadersOnly()
Deliver only headers, not payloads
-
setHeadersOnly
final Unit setHeadersOnly(Boolean <set-?>)
Deliver only headers, not payloads
-
getStartSequence
final Long getStartSequence()
Start sequence for BY_START_SEQUENCE deliver policy
-
setStartSequence
final Unit setStartSequence(Long <set-?>)
Start sequence for BY_START_SEQUENCE deliver policy
-
getStartTime
final ZonedDateTime getStartTime()
Start time for BY_START_TIME deliver policy
-
setStartTime
final Unit setStartTime(ZonedDateTime <set-?>)
Start time for BY_START_TIME deliver policy
-
getDeliverSubject
final String getDeliverSubject()
Deliver subject for push consumers
-
setDeliverSubject
final Unit setDeliverSubject(String <set-?>)
Deliver subject for push consumers
-
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)
-
getMemoryStorage
final Boolean getMemoryStorage()
Enable memory storage for the consumer state
-
setMemoryStorage
final Unit setMemoryStorage(Boolean <set-?>)
Enable memory storage for the consumer state
-
-
-
-