Skip to content

Add max_attempts config option to NatsListener for non-daemon callers #331

@mvillmow

Description

@mvillmow

NatsListener currently retries indefinitely (correct for daemon startup). However, callers in test harnesses or short-lived processes need a way to bound retries. Add an optional max_attempts: std::optional<uint32_t> = std::nullopt field to NatsListener::Config. When set, throw std::runtime_error after exceeding the limit rather than looping forever. This makes the class usable outside daemon contexts without changing the default behaviour.

Follow-up from #139

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions