Skip to content

ConsumerConfig

nats.js.api.ConsumerConfig dataclass #

ConsumerConfig(name=None, durable_name=None, description=None, deliver_policy=ALL, opt_start_seq=None, opt_start_time=None, ack_policy=EXPLICIT, ack_wait=None, max_deliver=None, backoff=None, filter_subject=None, filter_subjects=None, replay_policy=INSTANT, rate_limit_bps=None, sample_freq=None, max_waiting=None, max_ack_pending=None, flow_control=None, idle_heartbeat=None, headers_only=None, deliver_subject=None, deliver_group=None, inactive_threshold=None, num_replicas=None, mem_storage=None, metadata=None)

Bases: Base

Consumer configuration.

References
  • Consumers <https://docs.nats.io/jetstream/concepts/consumers>_

name class-attribute instance-attribute #

name = None

durable_name class-attribute instance-attribute #

durable_name = None

description class-attribute instance-attribute #

description = None

deliver_policy class-attribute instance-attribute #

deliver_policy = ALL

opt_start_seq class-attribute instance-attribute #

opt_start_seq = None

opt_start_time class-attribute instance-attribute #

opt_start_time = None

ack_policy class-attribute instance-attribute #

ack_policy = EXPLICIT

ack_wait class-attribute instance-attribute #

ack_wait = None

max_deliver class-attribute instance-attribute #

max_deliver = None

backoff class-attribute instance-attribute #

backoff = None

filter_subject class-attribute instance-attribute #

filter_subject = None

filter_subjects class-attribute instance-attribute #

filter_subjects = None

replay_policy class-attribute instance-attribute #

replay_policy = INSTANT

rate_limit_bps class-attribute instance-attribute #

rate_limit_bps = None

sample_freq class-attribute instance-attribute #

sample_freq = None

max_waiting class-attribute instance-attribute #

max_waiting = None

max_ack_pending class-attribute instance-attribute #

max_ack_pending = None

flow_control class-attribute instance-attribute #

flow_control = None

idle_heartbeat class-attribute instance-attribute #

idle_heartbeat = None

headers_only class-attribute instance-attribute #

headers_only = None

deliver_subject class-attribute instance-attribute #

deliver_subject = None

deliver_group class-attribute instance-attribute #

deliver_group = None

inactive_threshold class-attribute instance-attribute #

inactive_threshold = None

num_replicas class-attribute instance-attribute #

num_replicas = None

mem_storage class-attribute instance-attribute #

mem_storage = None

metadata class-attribute instance-attribute #

metadata = None

evolve #

evolve(**params)

Return a copy of the instance with the passed values replaced.

Source code in nats/js/api.py
def evolve(self: _B, **params) -> _B:
    """Return a copy of the instance with the passed values replaced.
    """
    return replace(self, **params)

from_response classmethod #

from_response(resp)
Source code in nats/js/api.py
@classmethod
def from_response(cls, resp: Dict[str, Any]):
    cls._convert_nanoseconds(resp, 'ack_wait')
    cls._convert_nanoseconds(resp, 'idle_heartbeat')
    cls._convert_nanoseconds(resp, 'inactive_threshold')
    if 'backoff' in resp:
        resp['backoff'] = [val / _NANOSECOND for val in resp['backoff']]
    return super().from_response(resp)

as_dict #

as_dict()
Source code in nats/js/api.py
def as_dict(self) -> Dict[str, object]:
    result = super().as_dict()
    result['ack_wait'] = self._to_nanoseconds(self.ack_wait)
    result['idle_heartbeat'] = self._to_nanoseconds(self.idle_heartbeat)
    result['inactive_threshold'] = self._to_nanoseconds(
        self.inactive_threshold
    )
    if self.backoff:
        result['backoff'] = [self._to_nanoseconds(i) for i in self.backoff]
    return result