-
According to the Brighter documentation I can apply policies to subscriptions via the public class MyRequestHandler : RequestHandler<MyRequest>
{
[UsePolicy(...)]
public override MyRequest Handle(MyRequest request)
{
// handle request
}
} My use case requires me to get out an alert and stop processing further messages when certain errors happen in my handlers, and the most straightforward way to do that would be to throw a custom exception when it happens and use a fallback policy that looks like this: // inside fallback handler
if (ex is ExceptionThatINeedToLookFor)
{
/*
code for sending out alert
*/
// tell brighter that the exception hasn't been handled, so the offending message isn't marked as handled
// and further messages aren't processed based on the circuit breaker policy
throw ex;
} However using an attribute based policy application would be cumbersome and error prone since I need this policy applied to all of my handlers. It is also my understandng that if I use this attribute based approach, only errors arising in Is there a way to globally apply a policy that would:
I am using Brighter version 9, if it's of any help. Thank you for the help, it's much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As far as I know we don't have any to support global policy adding a request policy global. Maybe @iancooper knows more about it |
Beta Was this translation helpful? Give feedback.
As far as I know we don't have any to support global policy adding a request policy global.
Maybe @iancooper knows more about it