Re: Exceptions in event handlers
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
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