Closed AlexKulbako closed 3 years ago
Hi @AlexKulbako. Thanks for your interest in the Pitstop sample and your comment.
Yes, using the outbox pattern is a good way of making this more robust. I chose not to use this pattern here to keep it simple.
Additionally, take into consideration that when using an outbox pattern, the actual sending of the event that occurs in the background could still fail (even after some retries). But then this happens outside the context of the synchronous call (in this particular case). So the caller is unaware of this error. You need some other way of catching these errors (e.g. through monitoring).
Thanks @EdwinVW for your answer, as earlier I was also thinking to make use if transactional outbox pattern here. Now your pragmatic approach really enlightened me!
I was wondering if there is a right approach to do this:
What happens if after you have called await _dbContext.SaveChangesAsync(); an error occurs when sending an event. Does it mean we will lose this event? Should we transactional outbox pattern here?