Hello! While my journey with IPA has been anything but less than amazing, I’m thinking of relationship with other kinds..you know like lagers, pilsners :) The latter sound more refreshing at the moment…may be its the heat!

Updates

Code for this post is in branch: learning-unbeered-9.

In this update, I added a new functionality where, if I had more than 4 beers in one entry, I get an alert. While this is an easy feature, the goal was to use notification feature of MediatR and therefore a step towards event based publish/subscribe style. It was as easy as adding ReportTooManyBeers.cs!

Now that we have “NewEntryAddedNotification” event that gets published, we can add in any features around it without having to change anything in the publishing code. We’d just add in a new handler that gets invoked every time the event is published!

Other improvements:

  • Updated MediatR to v5
  • Added a new MediatR extension package MediatR.Extensions.Microsoft.DependencyInjection. This makes our lives simple by automatically registering our handlers! I was able to remove a lot of code in Program.cs.
  • Console outputs both the cached version of tally and aggregated version.

Whats next?

  • Alert if I have beers for three consecutive days! I think this will be an interesting feature.