Re: Re: Exceptions in event handlers
"Greg Young [email protected] [domaindrivendesign]" <[email protected]> Thu, 23 Apr 2015 14:12:35 +0300
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <CAC9RQthxQid==G5vo4TFyJ=0sJbb-tK7j4jjr3wpeLa5aQkxcg@mail.gmail.com> |
" you think you have a "logic" exception, then that would mean that something about the event is "wrong", which would mean that the event didn't actually happen from a business perspective, which would mean that the publisher of the event shouldn't have published it, which would mean that your design is wrong." Why does a logic error in subscriber say a producer should have never published an event? At best this is implying 1-1 relationships between producers and subscribers. Instead of all this it could also mean the event was perfectly fine, your design is fine, and you have a bug in a subscriber of many. On 22 Apr 2015 14:45, "[email protected] [domaindrivendesign]" <[email protected]> wrote: > > > If it's something as simple as a deadlock or concurrency exception, you > should probably retry processing the event with some exponential backoff, > finally escalating to notifying an admin. > > You can look at how we do that in NServiceBus for some implementation > ideas. > > In general, try not to use business logic to compensate for infrastructure > exceptions. > > If you think you have a "logic" exception, then that would mean that > something about the event is "wrong", which would mean that the event > didn't actually happen from a business perspective, which would mean that > the publisher of the event shouldn't have published it, which would mean > that your design is wrong. > > In general, writing more code based on a wrong design isn't helpful either. > > Udi > >