Made a few updates! One of the major changes was removing MediatR and replacing it with Rebus! More about Rebus can be found here.
- Used Rebus ServiceBus for asynchronous communication! Using Rebus we can use durable queues to flow the messages between different parts of our application. It also does exponential automatic retries upon failure. Our application code can fail for various reasons such as unreachable database, network failure, bugs etc. With automatic retries, Rebus will try to deliver messages to their handlers 5 times by default. Messages that still fail will be sent to error queue/ dead letter queue. Admin can look at error queue, get the exception detail and re-return the message after fixing the issue! In the previous version of the app we had no automatic retries and the failed messages were lost for ever!
- Database cleaning may need to be synchronous action
- Since adding new entries are now handled asynchronously, the calculation data becomes eventually consistent. Our console app is synchronous and therefore results in the console app may not reflect up to date data. To mitigate, or simulate consistency, use thread sleep after cleaning database and also before printing console. If we allowed UI to be refreshed, we’d not have to do this hack!
- Update the app to .net core 3.0?
- Use .net generic host to bootstrap the application as described here.