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

Usability issue with error handling implementations of HandlerChainPolicy #167

Open
mkmurray opened this issue Feb 25, 2014 · 0 comments
Open
Assignees

Comments

@mkmurray
Copy link
Contributor

Custom error policies for FT are currently done today by creating a HandlerChainPolicy. It allows you to do things like this:

public class ICommandChainsErrorHandlingPolicy : HandlerChainPolicy
{
    public override void Configure(HandlerChain chain)
    {
        chain.MaximumAttempts = 10;
        chain.OnException<ConcurrencyException>().Retry();
        chain.OnException<TimeoutException>().Retry();
    }

    public override bool Matches(HandlerChain chain)
    {
        return chain.InputType().CanBeCastTo<ICommand>();
    }
}

However, @jeremydmiller admitted he hadn't thought of the use case where you would have multiple error handling policies each with their own Matches implementation. I had another error handling policy after this one that applied to all chains and ended up stomping on this first one, changing the MaximumAttempts value back down to 5.

Jeremy asked that I start this issue to discuss how to make this API more clear. Perhaps we only allow one ErrorPolicy, or make it a setter instead of a method. With that, I can see where I would want different MaximumAttempts retry counts depending on the Exception, not just chain wide.

For now, I'm going to either combine my two policies into one if possible, or at least make the two of them smarter and in the right order so that nothing is stomped over.

@jeremydmiller jeremydmiller self-assigned this Feb 28, 2014
@jeremydmiller jeremydmiller modified the milestone: 0.6 Feb 28, 2014
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

2 participants