Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add max_attempts_at_message #395

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Arseniy-Popov
Copy link

@Arseniy-Popov Arseniy-Popov commented Dec 28, 2024

This addresses the issue taskiq-python/taskiq-aio-pika#35.

@Arseniy-Popov Arseniy-Popov force-pushed the feat/add-max-attempts-at-message branch 2 times, most recently from 1a432e5 to 1adb5a5 Compare December 29, 2024 15:28
@Arseniy-Popov Arseniy-Popov marked this pull request as ready for review December 29, 2024 17:44
@Arseniy-Popov Arseniy-Popov force-pushed the feat/add-max-attempts-at-message branch from 1adb5a5 to 0737287 Compare January 26, 2025 15:54
@Arseniy-Popov Arseniy-Popov changed the base branch from develop to master January 26, 2025 15:55
Copy link

codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.65%. Comparing base (fec9633) to head (0737287).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #395      +/-   ##
==========================================
+ Coverage   77.51%   77.65%   +0.14%     
==========================================
  Files          62       62              
  Lines        1899     1911      +12     
==========================================
+ Hits         1472     1484      +12     
  Misses        427      427              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@s3rius
Copy link
Member

s3rius commented Feb 4, 2025

I don't think this PR should be implemented this way and affect base classes such as AckableMessage. Also in here I don't see anywhere how you set this redeliver information to a message. If you expect brokers to do it, then I refuse to merge it, because Broker API should remain simple to implement.

I think that it will be much easier for you to implement such functionality as a middleware and add it in taskiq.middlewares.

@Arseniy-Popov
Copy link
Author

Arseniy-Popov commented Feb 4, 2025

Thanks for the reply.

I don't see anywhere how you set this redeliver information to a message.

As my issue explains, RabbitMQ does this by itself: if a message that was delivered isn't acked but the connection with the consuming client closes, RabbitMQ requeues the message to the front of the queue and sets a x-delivery-count header.

base classes such as AckableMessage

The issue currently is that message headers, including the one talked about above, aren't being passed to the message the receiver works with. They need to be put somewhere, either into the TaskiqMessage or its wrapper.

implement such functionality as a middleware

The middleware would still need access to the message headers. It would also need access to the message's ack callback, and the pre_execute method would need to be able to break the current processing (raising an exception in it doesn't seem viable at first glance).

Also bear in mind there is a separate PR on the taskiq-aio-pika side that deals with RabbitMQ's settings and propagating the header: taskiq-python/taskiq-aio-pika/pull/37.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants