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

Queue: Correlate the exception with a taskId #419

Open
brettwinters opened this issue Dec 6, 2024 · 0 comments
Open

Queue: Correlate the exception with a taskId #419

brettwinters opened this issue Dec 6, 2024 · 0 comments

Comments

@brettwinters
Copy link

brettwinters commented Dec 6, 2024

Hello

Thanks for this great library.

I have a question or feature suggestion for the queue's exception handling. I want to correlate the exception with a taskId, but the IListener<DequeuedTaskFailed> does not include the Exception and the OnError(ex => {}) does not include the TaskId:

If I invoke a queue which throws:

var taskId = _queue.QueueAsyncTask(async () => {
    throw new Exception();
}

I can listen for the exception here:

public class DequeuedTaskFailedListener : IListener<DequeuedTaskFailed>
{
    public Task HandleAsync(DequeuedTaskFailed e)
    {
         // no exception provided
         e.Exception?
    }
}

and/or here:

.OnError(ex => {
    //no taskId provided

});

What is the pattern should I use?

Suggestions

(1) Include the Exception in the DequeuedTaskFailed property (DequeuedTaskFailed.Exception)
(2) Modify the delegate to include the taskId: .OnError((ex, taskId) => {});
(3) Allow users to set the taskId: _queue.QueueAsyncTask(taskId: Guid.NewGuid(), async () => { ... });

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

No branches or pull requests

1 participant