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 custom retry message processing for DLQ #1289

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add custom retry message processing for DLQ #1289

wants to merge 4 commits into from

Conversation

GAlexIHU
Copy link
Contributor

@GAlexIHU GAlexIHU commented Aug 2, 2024

Overview

Let's continue the DLQ implementation discussion & changes over here (branched form #1280) to unblock the ingest event batching

@GAlexIHU GAlexIHU added the release-note/misc Miscellaneous changes label Aug 2, 2024
@GAlexIHU GAlexIHU requested a review from turip August 2, 2024 13:49
@GAlexIHU GAlexIHU force-pushed the feat/batch-ingest-events-for-balance-calculation branch from 2a9c906 to 15ba18c Compare August 2, 2024 14:53
Base automatically changed from feat/batch-ingest-events-for-balance-calculation to main August 5, 2024 08:45

// DLQ provides a middleware that salvages unprocessable messages and published them on a separate topic.
// The main middleware chain then continues on, business as usual.
func DLQ(pub message.Publisher, topic string, msgProcessor DLQMsgProcessorFunc) (message.HandlerMiddleware, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's worth creating a DLQ implementation for this. I would rather have the following logic in the event handler:

- try to calculate the entitlements
- collect the successfully and unsuccessfully generated entitlements
- publish the successfully generated snapshots
- publish a EventBatchedIngest event with the remainder into the dlq topic

@sagikazarmark what do you think?

@GAlexIHU Given that I did a lot of refactoring around the handlers, I can take over this PR and wrap it up if you are fine with this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me, although I don't have a lot of context.

What you are suggesting sounds like "business logic" to me. DLQ is generally a good approach for blindly retrying without clogging up the original queue.

The above proposal sounds like a more "clever" retry approach where we only retry what needs to be retried. That sounds like business logic to me and DLQ may not be the best approach there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@turip I'm okay with you taking over, I've left this PR stale for the past some time no not much lost there

on the DLQ implementation topic, I think having a generic RetryableError or something of the sort will only make more sense as we go forward, but I'm fine either way for now

spec.ComposeResourcePath(entitlement.Namespace, spec.EntityEvent),
)
if err != nil {
return nil, err
// TODO: add error information too
handlingError = multierror.Append(handlingError, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use errors.Join instead?


// DLQ provides a middleware that salvages unprocessable messages and published them on a separate topic.
// The main middleware chain then continues on, business as usual.
func DLQ(pub message.Publisher, topic string, msgProcessor DLQMsgProcessorFunc) (message.HandlerMiddleware, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me, although I don't have a lot of context.

What you are suggesting sounds like "business logic" to me. DLQ is generally a good approach for blindly retrying without clogging up the original queue.

The above proposal sounds like a more "clever" retry approach where we only retry what needs to be retried. That sounds like business logic to me and DLQ may not be the best approach there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc Miscellaneous changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants