Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

nak() should follow backoff #5856

Open
tamis-laan opened this issue Sep 3, 2024 · 1 comment
Open

nak() should follow backoff #5856

tamis-laan opened this issue Sep 3, 2024 · 1 comment
Labels
proposal Enhancement idea or proposal

Comments

@tamis-laan
Copy link

Proposed change

Make msg.nak() follow the set backoff strategy in the consumer.

Use case

Given the following:

# Backoff strategy
backoff = [2,4,8,16,32]

# Consumer configuration
config = ConsumerConfig(
    durable_name="action_workers",
    backoff=backoff,
    ack_wait=backoff[-1],
    max_deliver=len(backoff) + 1
)

# Subscribe
sub = await js.pull_subscribe("action.process.*", durable="action_workers", config=config)

while True:
    msgs = await sub.fetch(1)
    for msg in msgs:
        print(msg)
        msg.nak()

I would expect msg.nak() to make use of the backoff strategy. However backoff is only used for retries.

Contribution

No response

@tamis-laan tamis-laan added the proposal Enhancement idea or proposal label Sep 3, 2024
@Jarema
Copy link
Member

Jarema commented Sep 3, 2024

nak marks message for immediate redelivery, so it does not apply ack_wait, or backoff, which is used in case of user not sending back anything.

You can however specify nak(delay) to achieve what I think would solve your use case.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
proposal Enhancement idea or proposal
Projects
None yet
Development

No branches or pull requests

2 participants